The drag handler is used to deal with sequences of browser events related to dragging. The
handler is used by controls that want to know when a drag sequence begins, when a drag is
happening, and when it has finished.
Controls that use the drag handler typically construct it with callbacks for ‘down’,
‘move’, and ‘done’. Callbacks for these keys are called when the
drag begins, with each move, and when the drag is done. In addition, controls can have
callbacks keyed to ‘up’ and ‘out’ if they care to differentiate between
the types of events that correspond with the end of a drag sequence. If no drag actually
occurs (no mouse move) the ‘down’ and ‘up’ callbacks will be called, but
not the ‘done’ callback.
Create a new drag handler with the ALKMaps.Handler.Drag constructor.
Inherits from
Summary
| ALKMaps.Handler.Drag |
The drag handler is used to deal with sequences of browser
events related to dragging. |
| Properties |
|
| started |
{Boolean} When a mousedown or touchstart event is received,
we want to record it, but not set ‘dragging’ until the mouse moves
after starting. |
| stopDown |
{Boolean} Stop propagation of mousedown events from getting
to listeners on the same element. |
| dragging |
{Boolean} |
| touch |
{Boolean} When a touchstart event is fired, touch will be
true and all mouse related listeners will do nothing. |
| last |
{ALKMaps.Pixel} The last pixel location of
the drag. |
| start |
{ALKMaps.Pixel} The first pixel location of
the drag. |
| lastMoveEvt |
{Object} The last mousemove event that occurred. |
| oldOnselectstart |
{Function} |
| interval |
{Integer} In order to increase performance, an interval (in
milliseconds) can be set to reduce the number of drag events called. |
| timeoutId |
{String} The id of the timeout used for the mousedown
interval. |
| documentDrag |
{Boolean} If set to true, the handler will also handle mouse
moves when the cursor has moved out of the map viewport. |
| documentEvents
|
{Boolean} Are we currently observing document events? |
| lockMapPanning
|
{Boolean} Indicates whether or not the handler should prevent
the ability to pan the map during a drag event. |
| panLock |
{Boolean} Indicates whether or not the handler currently has
a lock on panning the map. |
| Constructor |
|
| ALKMaps.Handler.Drag
|
Returns ALKMaps.Handler.Drag |
| Functions |
|
| dragstart |
This private method is factorized from mousedown and
touchstart methods |
| dragmove |
This private method is factorized from mousemove and
touchmove methods |
| dragend |
This private method is factorized from mouseup and touchend
methods |
| down |
This method is called during the handling of the mouse down
event. |
| move |
This method is called during the handling of the mouse move
event. |
| up |
This method is called during the handling of the mouse up
event. |
| out |
This method is called during the handling of the mouse out
event. |
| mousedown |
Handle mousedown events |
| touchstart |
Handle touchstart events |
| mousemove |
Handle mousemove events |
| touchmove |
Handle touchmove events |
| removeTimeout |
Private. |
| mouseup |
Handle mouseup events |
| touchend |
Handle touchend events |
| mouseout |
Handle mouseout events |
| click |
The drag handler captures the click event. |
| activate |
Activate the handler. |
| deactivate |
Deactivate the handler. |
| adjustXY |
Converts event coordinates that are relative to the document
body to ones that are relative to the map viewport. |
| addDocumentEvents |
Start observing document events when documentDrag is true and
the mouse cursor leaves the map viewport while dragging. |
| removeDocumentEvents |
Stops observing document events when documentDrag is true and
the mouse cursor re-enters the map viewport while dragging. |