The Canvas object (e.g., a Token, Tile, or Drawing) to which mouse events should be bound.
The Canvas Layer that contains the object.
Optional
permissions: object = {}An object of permission checks, keyed by action name, which return a boolean or invoke a function for whether the action is allowed.
Optional
callbacks: object = {}An object of callback functions, keyed by action name, which will be executed during the event workflow (e.g., hoverIn, clickLeft).
Optional
options: { application?: Application<ICanvas>; dragResistance?: number; target?: string } = {}Additional options that configure interaction behavior.
Optional
application?: Application<ICanvas>A specific PIXI Application to use for pointer event handling
defaults to canvas.app
if not provided.
Optional
dragResistance?: numberA minimum number of pixels the mouse must move before a drag is initiated.
Optional
target?: stringIf provided, the property name on object
which references a
foundry.canvas.containers.ControlIcon.
This is used to set MouseInteractionManager#controlIcon.
Internal
_dragA flag for whether we are right-click dragging
An optional ControlIcon instance for the object
The drag handling time
Bound interaction data object to populate with custom data.
The client position of the last left/right-click.
The time of the last left-click event
Interaction options which configure handling workflows
The time of the last right-click event
The current interaction state
The view id pertaining to the PIXI Application. If not provided, default to canvas.app.view.id
Static
DEFAULT_The minimum distance, measured in screen-coordinate pixels, that a pointer must move to initiate a drag operation.
This default value can be overridden by specifying the dragResistance
option when invoking the constructor.
Static
DOUBLE_The maximum number of pixels between two clicks to be considered a double-click.
Static
DOUBLE_The maximum number of milliseconds between two clicks to be considered a double-click.
Static
INTERACTION_Enumerate the states of a mouse interaction workflow. 0: NONE - the object is inactive 1: HOVER - the mouse is hovered over the object 2: CLICKED - the object is clicked 3: GRABBED - the object is grabbed 4: DRAG - the object is being dragged 5: DROP - the object is being dropped
Static
LONG_The number of milliseconds of mouse click depression to consider it a long press.
Static
longGlobal timeout for the long-press event.
A reference to the possible interaction states which can be observed
Is this mouse manager in a dragging state?
A reference to the possible interaction states which can be observed
Get the target.
Activate interactivity for the handled object
Execute a callback function associated with a certain action in the workflow
The action being attempted
The event being handled
Additional callback arguments.
A boolean which may indicate that the event was handled by the callback. Events which do not specify a callback are assumed to have been handled as no-op.
Test whether the current user has permission to perform a step of the workflow
The action being attempted
The event being handled
Can the action be performed?
A public method to cancel a current interaction workflow from this manager.
Optional
event: FederatedEvent<UIEvent | PixiTouch>The event that initiates the cancellation
A public method to handle directly an event into this manager, according to its type. Note: drag events are not handled.
Has the event been processed?
Reset the mouse manager.
Optional
options: { interactionData?: boolean; state?: boolean } = {}Optional
interactionData?: booleanReset the interaction data?
Optional
state?: booleanReset the state?
Static
emulateEmulate a pointermove event on the main game canvas. This method must be called when an object with the static event mode or any of its parents is transformed or its visibility is changed.
Handle mouse interaction events for a Canvas object. There are three phases of events: hover, click, and drag
Hover Events: _handlePointerOver action: hoverIn _handlePointerOut action: hoverOut
Left Click and Double-Click _handlePointerDown action: clickLeft action: clickLeft2 action: unclickLeft
Right Click and Double-Click _handleRightDown action: clickRight action: clickRight2 action: unclickRight
Drag and Drop _handlePointerMove action: dragLeftStart action: dragRightStart action: dragLeftMove action: dragRightMove _handlePointerUp action: dragLeftDrop action: dragRightDrop _handleDragCancel action: dragLeftCancel action: dragRightCancel