114 lines
3.3 KiB
JavaScript
114 lines
3.3 KiB
JavaScript
|
|
"use strict";
|
||
|
|
var core = require("@pixi/core"), FederatedEvent = require("./FederatedEvent.js");
|
||
|
|
class FederatedMouseEvent extends FederatedEvent.FederatedEvent {
|
||
|
|
constructor() {
|
||
|
|
super(...arguments), this.client = new core.Point(), this.movement = new core.Point(), this.offset = new core.Point(), this.global = new core.Point(), this.screen = new core.Point();
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get clientX() {
|
||
|
|
return this.client.x;
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get clientY() {
|
||
|
|
return this.client.y;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Alias for {@link PIXI.FederatedMouseEvent.clientX this.clientX}.
|
||
|
|
* @readonly
|
||
|
|
*/
|
||
|
|
get x() {
|
||
|
|
return this.clientX;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Alias for {@link PIXI.FederatedMouseEvent.clientY this.clientY}.
|
||
|
|
* @readonly
|
||
|
|
*/
|
||
|
|
get y() {
|
||
|
|
return this.clientY;
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get movementX() {
|
||
|
|
return this.movement.x;
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get movementY() {
|
||
|
|
return this.movement.y;
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get offsetX() {
|
||
|
|
return this.offset.x;
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get offsetY() {
|
||
|
|
return this.offset.y;
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get globalX() {
|
||
|
|
return this.global.x;
|
||
|
|
}
|
||
|
|
/** @readonly */
|
||
|
|
get globalY() {
|
||
|
|
return this.global.y;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* The pointer coordinates in the renderer's screen. Alias for {@code screen.x}.
|
||
|
|
* @readonly
|
||
|
|
*/
|
||
|
|
get screenX() {
|
||
|
|
return this.screen.x;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* The pointer coordinates in the renderer's screen. Alias for {@code screen.y}.
|
||
|
|
* @readonly
|
||
|
|
*/
|
||
|
|
get screenY() {
|
||
|
|
return this.screen.y;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* This will return the local coordinates of the specified displayObject for this InteractionData
|
||
|
|
* @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local
|
||
|
|
* coords off
|
||
|
|
* @param {PIXI.IPointData} point - A Point object in which to store the value, optional (otherwise
|
||
|
|
* will create a new point)
|
||
|
|
* @param {PIXI.IPointData} globalPos - A Point object containing your custom global coords, optional
|
||
|
|
* (otherwise will use the current global coords)
|
||
|
|
* @returns - A point containing the coordinates of the InteractionData position relative
|
||
|
|
* to the DisplayObject
|
||
|
|
*/
|
||
|
|
getLocalPosition(displayObject, point, globalPos) {
|
||
|
|
return displayObject.worldTransform.applyInverse(globalPos || this.global, point);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Whether the modifier key was pressed when this event natively occurred.
|
||
|
|
* @param key - The modifier key.
|
||
|
|
*/
|
||
|
|
getModifierState(key) {
|
||
|
|
return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(key);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Not supported.
|
||
|
|
* @param _typeArg
|
||
|
|
* @param _canBubbleArg
|
||
|
|
* @param _cancelableArg
|
||
|
|
* @param _viewArg
|
||
|
|
* @param _detailArg
|
||
|
|
* @param _screenXArg
|
||
|
|
* @param _screenYArg
|
||
|
|
* @param _clientXArg
|
||
|
|
* @param _clientYArg
|
||
|
|
* @param _ctrlKeyArg
|
||
|
|
* @param _altKeyArg
|
||
|
|
* @param _shiftKeyArg
|
||
|
|
* @param _metaKeyArg
|
||
|
|
* @param _buttonArg
|
||
|
|
* @param _relatedTargetArg
|
||
|
|
* @deprecated since 7.0.0
|
||
|
|
*/
|
||
|
|
// eslint-disable-next-line max-params
|
||
|
|
initMouseEvent(_typeArg, _canBubbleArg, _cancelableArg, _viewArg, _detailArg, _screenXArg, _screenYArg, _clientXArg, _clientYArg, _ctrlKeyArg, _altKeyArg, _shiftKeyArg, _metaKeyArg, _buttonArg, _relatedTargetArg) {
|
||
|
|
throw new Error("Method not implemented.");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
exports.FederatedMouseEvent = FederatedMouseEvent;
|
||
|
|
//# sourceMappingURL=FederatedMouseEvent.js.map
|