- 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
- 156
- 157
import type { InteractionTrackingData } from './InteractionTrackingData';
type Cursor = 'auto'
| 'default'
| 'none'
| 'context-menu'
| 'help'
| 'pointer'
| 'progress'
| 'wait'
| 'cell'
| 'crosshair'
| 'text'
| 'vertical-text'
| 'alias'
| 'copy'
| 'move'
| 'no-drop'
| 'not-allowed'
| 'e-resize'
| 'n-resize'
| 'ne-resize'
| 'nw-resize'
| 's-resize'
| 'se-resize'
| 'sw-resize'
| 'w-resize'
| 'ns-resize'
| 'ew-resize'
| 'nesw-resize'
| 'col-resize'
| 'nwse-resize'
| 'row-resize'
| 'all-scroll'
| 'zoom-in'
| 'zoom-out'
| 'grab'
| 'grabbing';
export interface IHitArea
{
contains(x: number, y: number): boolean;
}
export interface InteractiveTarget
{
interactive: boolean;
interactiveChildren: boolean;
hitArea: IHitArea | null;
cursor: Cursor | string;
buttonMode: boolean;
trackedPointers: {[x: number]: InteractionTrackingData};
_trackedPointers: {[x: number]: InteractionTrackingData};
}
/**
* Interface for classes that represent a hit area.
*
* It is implemented by the following classes:
* - {@link PIXI.Circle}
* - {@link PIXI.Ellipse}
* - {@link PIXI.Polygon}
* - {@link PIXI.RoundedRectangle}
* @interface IHitArea
* @memberof PIXI
*/
/**
* Checks whether the x and y coordinates given are contained within this area
* @method
* @name contains
* @memberof PIXI.IHitArea#
* @param {number} x - The X coordinate of the point to test
* @param {number} y - The Y coordinate of the point to test
* @returns {boolean} Whether the x/y coordinates are within this area
*/
/**
* Default property values of interactive objects
* Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties
* @private
* @name interactiveTarget
* @type {object}
* @memberof PIXI
* @example
* function MyObject() {}
*
* Object.assign(
* DisplayObject.prototype,
* PIXI.interactiveTarget
* );
*/
export const interactiveTarget: InteractiveTarget = {
interactive: false,
interactiveChildren: true,
hitArea: null,
/**
* If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive
* Setting this changes the 'cursor' property to `'pointer'`.
* @example
* const sprite = new PIXI.Sprite(texture);
* sprite.interactive = true;
* sprite.buttonMode = true;
* @member {boolean}
* @memberof PIXI.DisplayObject#
*/
get buttonMode(): boolean
{
return this.cursor === 'pointer';
},
set buttonMode(value: boolean)
{
if (value)
{
this.cursor = 'pointer';
}
else if (this.cursor === 'pointer')
{
this.cursor = null;
}
},
/**
* This defines what cursor mode is used when the mouse cursor
* is hovered over the displayObject.
* @example
* const sprite = new PIXI.Sprite(texture);
* sprite.interactive = true;
* sprite.cursor = 'wait';
* @see https://developer.mozilla.org/en/docs/Web/CSS/cursor
* @member {string}
* @memberof PIXI.DisplayObject#
*/
cursor: null,
/**
* Internal set of all active pointers, by identifier
* @member {Map<number, InteractionTrackingData>}
* @memberof PIXI.DisplayObject#
* @private
*/
get trackedPointers()
{
if (this._trackedPointers === undefined) this._trackedPointers = {};
return this._trackedPointers;
},
/**
* Map of all tracked pointers, by identifier. Use trackedPointers to access.
* @private
* @type {Map<number, InteractionTrackingData>}
*/
_trackedPointers: undefined,
};