LayerGroupPointer
Source: layerGroupPointer.js:85
Normalises layer mouse/touch input into a single-pointer drag lifecycle. Per-move deltas are computed inside DragBehavior#onUpdate. Hover (HoverBehavior) is driven from mouse events only, not touch.
Extends EventTarget so subclasses (tools) can use addEventListener / dispatchEvent like other UI tools.
Event entry points use the same names as tools (mousedown, mousemove, wheel, dblclick, …). Those handlers are arrow functions so they stay bound when the toolbox invokes them as bare callbacks (func(event)).
preventDefault is only called on the NonPassiveInteractionEventNames (from gui/generic.js), the events the layers listen to as not passive.
Constructor
new LayerGroupPointer(
options: LayerGroupPointerOptions,
): LayerGroupPointerParameters
options(LayerGroupPointerOptions) — Constructor options.
Instance Methods
getEventNames(): Array.<string>
Get the list of event names that this tool can fire. Default implementation returns an empty array.
Returns
Array.<string>— The list of event names.
cancel()
End behaviors that have end method.
Instance Fields
wheel
Handle mouse wheel. Prevents the default (page scroll) only when the tool has a wheel behaviour.
Parameters
event(WheelEvent) — The mouse wheel event.
dblclick
Parameters
event(MouseEvent) — The double click event.
mousedown
Handle mouse down.
Parameters
event(MouseEvent) — The mouse down event.
mousemove
Handle mouse move.
Parameters
event(MouseEvent) — The mouse move event.
mouseup
Handle mouse up.
Parameters
event(MouseEvent) — The mouse up event.
mouseout
Parameters
_event(MouseEvent) — The mouse out event.
touchstart
Handle touch start. Always prevents the default to stop the browser from scrolling or zooming the page and from emulating mouse events (which would be handled a second time by the mouse handlers).
Parameters
event(TouchEvent) — The touch start event.
touchmove
Parameters
event(TouchEvent) — The touch move event.
touchend
Parameters
event(TouchEvent) — The touch end event.
touchcancel
Handle touch cancel: the browser or the system interrupted the touch (for example an incoming call or an OS gesture), end it with LayerGroupPointer#cancel.
Parameters
_event(TouchEvent) — The touch cancel event.