new Controller2D(callback [, options])
Creates a new Controller2D instance.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
updatePosition | Function called when position is updated |
|||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Configuration options Properties
|
- Source:
Extends
Methods
-
<abstract> fingerDoubleTap(e)
-
Called for quick double mouse press or double finger touch.
Parameters:
Name Type Description e
Event The double tap event
- Inherited From:
- Overrides:
- Source:
-
fingerSingleTap(e)
-
Handles single tap/click events. Only processes events in absolute coordinate mode.
Parameters:
Name Type Description e
MouseEvent | TouchEvent Tap event
- Inherited From:
- Overrides:
- Source:
-
modifierState(e)
-
Gets the modifier state from an event.
Parameters:
Name Type Description e
Event The event to check
- Inherited From:
- Overrides:
- Source:
Returns:
Modifier state bitmask where:
- 0 = No modifiers
- 1 = Ctrl key
- 2 = Shift key
- 4 = Alt key Multiple modifiers combine their values (e.g., Ctrl+Shift = 3)
- Type
- number
-
<abstract> mouseWheel(e)
-
Called when user rotates mouse wheel.
Parameters:
Name Type Description e
WheelEvent The wheel event
- Inherited From:
- Overrides:
- Source:
-
panEnd(e)
-
Handles end of pan gesture.
Parameters:
Name Type Description e
MouseEvent | TouchEvent Pan end event
- Inherited From:
- Overrides:
- Source:
Returns:
False if not currently panning
- Type
- boolean
-
panMove(e)
-
Handles pan movement.
Parameters:
Name Type Description e
MouseEvent | TouchEvent Pan move event
- Inherited From:
- Overrides:
- Source:
Returns:
False if not currently panning
- Type
- boolean
-
panStart(e)
-
Handles start of pan gesture.
Parameters:
Name Type Description e
MouseEvent | TouchEvent Pan start event
- Inherited From:
- Overrides:
- Source:
-
<abstract> pinchEnd(e1, e2)
-
Called when pinch ends (finger lift).
Parameters:
Name Type Description e1
Event First finger event
e2
Event Second finger event
- Inherited From:
- Overrides:
- Source:
-
<abstract> pinchMove(e1, e2)
-
Called continuously during pinching.
Parameters:
Name Type Description e1
Event First finger event
e2
Event Second finger event
- Inherited From:
- Overrides:
- Source:
-
<abstract> pinchStart(e1, e2)
-
Called when user starts a two-finger pinch. Call e1.preventDefault() to capture the event.
Parameters:
Name Type Description e1
Event First finger event
e2
Event Second finger event
- Inherited From:
- Overrides:
- Source:
-
setPosition(x, y)
-
Updates the stored position for relative coordinate system. This is a convenience method typically used within callbacks.
Parameters:
Name Type Description x
number New X coordinate in range [-1, 1]
y
number New Y coordinate in range [-1, 1]
- Source: