Files
nothoughts/node_modules/pixi.js/lib/events/FederatedMouseEvent.mjs
2025-08-04 18:57:35 +02:00

130 lines
3.7 KiB
JavaScript

import { Point } from '../maths/point/Point.mjs';
import { FederatedEvent } from './FederatedEvent.mjs';
"use strict";
class FederatedMouseEvent extends FederatedEvent {
constructor() {
super(...arguments);
/** The coordinates of the mouse event relative to the canvas. */
this.client = new Point();
/** The movement in this pointer relative to the last `mousemove` event. */
this.movement = new Point();
/** The offset of the pointer coordinates w.r.t. target Container in world space. This is not supported at the moment. */
this.offset = new Point();
/** The pointer coordinates in world space. */
this.global = new Point();
/**
* The pointer coordinates in the renderer's {@link Renderer.screen screen}. This has slightly
* different semantics than native PointerEvent screenX/screenY.
*/
this.screen = new Point();
}
/** @readonly */
get clientX() {
return this.client.x;
}
/** @readonly */
get clientY() {
return this.client.y;
}
/**
* Alias for {@link FederatedMouseEvent.clientX this.clientX}.
* @readonly
*/
get x() {
return this.clientX;
}
/**
* Alias for {@link 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 container for this InteractionData
* @param {Container} container - The Container that you would like the local
* coords off
* @param {PointData} point - A Point object in which to store the value, optional (otherwise
* will create a new point)
* @param {PointData} 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 Container
*/
getLocalPosition(container, point, globalPos) {
return container.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.");
}
}
export { FederatedMouseEvent };
//# sourceMappingURL=FederatedMouseEvent.mjs.map