83 lines
3.0 KiB
JavaScript
83 lines
3.0 KiB
JavaScript
import { Point } from "@pixi/core";
|
|
class FederatedEvent {
|
|
/**
|
|
* @param manager - The event boundary which manages this event. Propagation can only occur
|
|
* within the boundary's jurisdiction.
|
|
*/
|
|
constructor(manager) {
|
|
this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = FederatedEvent.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = new Point(), this.page = new Point(), this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
|
|
}
|
|
/** @readonly */
|
|
get layerX() {
|
|
return this.layer.x;
|
|
}
|
|
/** @readonly */
|
|
get layerY() {
|
|
return this.layer.y;
|
|
}
|
|
/** @readonly */
|
|
get pageX() {
|
|
return this.page.x;
|
|
}
|
|
/** @readonly */
|
|
get pageY() {
|
|
return this.page.y;
|
|
}
|
|
/**
|
|
* Fallback for the deprecated @code{PIXI.InteractionEvent.data}.
|
|
* @deprecated since 7.0.0
|
|
*/
|
|
get data() {
|
|
return this;
|
|
}
|
|
/** The propagation path for this event. Alias for {@link PIXI.EventBoundary.propagationPath}. */
|
|
composedPath() {
|
|
return this.manager && (!this.path || this.path[this.path.length - 1] !== this.target) && (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.path;
|
|
}
|
|
/**
|
|
* Unimplemented method included for implementing the DOM interface {@code Event}. It will throw an {@code Error}.
|
|
* @deprecated
|
|
* @param _type
|
|
* @param _bubbles
|
|
* @param _cancelable
|
|
*/
|
|
initEvent(_type, _bubbles, _cancelable) {
|
|
throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
}
|
|
/**
|
|
* Unimplemented method included for implementing the DOM interface {@code UIEvent}. It will throw an {@code Error}.
|
|
* @deprecated
|
|
* @param _typeArg
|
|
* @param _bubblesArg
|
|
* @param _cancelableArg
|
|
* @param _viewArg
|
|
* @param _detailArg
|
|
*/
|
|
initUIEvent(_typeArg, _bubblesArg, _cancelableArg, _viewArg, _detailArg) {
|
|
throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
}
|
|
/** Prevent default behavior of PixiJS and the user agent. */
|
|
preventDefault() {
|
|
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault(), this.defaultPrevented = !0;
|
|
}
|
|
/**
|
|
* Stop this event from propagating to any addition listeners, including on the
|
|
* {@link PIXI.FederatedEventTarget.currentTarget currentTarget} and also the following
|
|
* event targets on the propagation path.
|
|
*/
|
|
stopImmediatePropagation() {
|
|
this.propagationImmediatelyStopped = !0;
|
|
}
|
|
/**
|
|
* Stop this event from propagating to the next {@link PIXI.FederatedEventTarget}. The rest of the listeners
|
|
* on the {@link PIXI.FederatedEventTarget.currentTarget currentTarget} will still be notified.
|
|
*/
|
|
stopPropagation() {
|
|
this.propagationStopped = !0;
|
|
}
|
|
}
|
|
export {
|
|
FederatedEvent
|
|
};
|
|
//# sourceMappingURL=FederatedEvent.mjs.map
|