- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
import { FederatedEvent } from './FederatedEvent';
import { Point } from '@pixi/math';
/**
* A {@link PIXI.FederatedEvent} for mouse events.
* @memberof PIXI
*/
export class FederatedMouseEvent extends FederatedEvent<
MouseEvent | PointerEvent | TouchEvent
> implements MouseEvent
{
/** Whether the "alt" key was pressed when this mouse event occurred. */
altKey: boolean;
/** The specific button that was pressed in this mouse event. */
button: number;
/** The button depressed when this event occurred. */
buttons: number;
/** Whether the "control" key was pressed when this mouse event occurred. */
ctrlKey: boolean;
/** Whether the "meta" key was pressed when this mouse event occurred. */
metaKey: boolean;
/** This is currently not implemented in the Federated Events API. */
relatedTarget: EventTarget;
/** Whether the "shift" key was pressed when this mouse event occurred. */
shiftKey: boolean;
/** The coordinates of the mouse event relative to the canvas. */
public client: Point = new Point();
/** @readonly */
public get clientX(): number { return this.client.x; }
/** @readonly */
public get clientY(): number { return this.client.y; }
/**
* Alias for {@link FederatedMouseEvent.clientX this.clientX}.
* @readonly
*/
get x(): number { return this.clientX; }
/**
* Alias for {@link FederatedMouseEvent.clientY this.clientY}.
* @readonly
*/
get y(): number { return this.clientY; }
/** This is the number of clicks that occurs in 200ms/click of each other. */
public detail: number;
/** The movement in this pointer relative to the last `mousemove` event. */
public movement: Point = new Point();
/** @readonly */
get movementX(): number { return this.movement.x; }
/** @readonly */
get movementY(): number { return this.movement.y; }
/**
* The offset of the pointer coordinates w.r.t. target DisplayObject in world space. This is
* not supported at the moment.
*/
public offset: Point = new Point();
/** @readonly */
get offsetX(): number { return this.offset.x; }
/** @readonly */
get offsetY(): number { return this.offset.y; }
/** The pointer coordinates in world space. */
public global: Point = new Point();
/** @readonly */
get globalX(): number { return this.global.x; }
/** @readonly */
get globalY(): number { return this.global.y; }
/**
* The pointer coordinates in the renderer's {@link PIXI.Renderer.screen screen}. This has slightly
* different semantics than native PointerEvent screenX/screenY.
*/
public screen: Point = new Point();
/**
* The pointer coordinates in the renderer's screen. Alias for {@code screen.x}.
* @readonly
*/
get screenX(): number { return this.screen.x; }
/**
* The pointer coordinates in the renderer's screen. Alias for {@code screen.y}.
* @readonly
*/
get screenY(): number { return this.screen.y; }
/**
* Whether the modifier key was pressed when this event natively occurred.
* @param key - The modifier key.
*/
getModifierState(key: string): boolean
{
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
*/
// eslint-disable-next-line max-params
initMouseEvent(
_typeArg: string,
_canBubbleArg: boolean,
_cancelableArg: boolean,
_viewArg: Window,
_detailArg: number,
_screenXArg: number,
_screenYArg: number,
_clientXArg: number,
_clientYArg: number,
_ctrlKeyArg: boolean,
_altKeyArg: boolean,
_shiftKeyArg: boolean,
_metaKeyArg: boolean,
_buttonArg: number,
_relatedTargetArg: EventTarget
): void
{
throw new Error('Method not implemented.');
}
}