OpenLayers. Handler.Drag

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.

Create a new drag handler with the OpenLayers.Handler.Drag constructor.

Inherits from

Summary
The drag handler is used to deal with sequences of browser events related to dragging.
{Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting.
{Boolean}
{OpenLayers.Pixel} The last pixel location of the drag.
{OpenLayers.Pixel} The first pixel location of the drag.
{Function}
Returns OpenLayers.Handler.Drag
This method is called during the handling of the mouse down event.
This method is called during the handling of the mouse move event.
This method is called during the handling of the mouse up event.
This method is called during the handling of the mouse out event.
Handle mousedown events
Handle mousemove events
Handle mouseup events
Handle mouseout events
The drag handler captures the click event.
Activate the handler.
Deactivate the handler.

Properties

started

{Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting.

dragging

{Boolean}

last

{OpenLayers.Pixel} The last pixel location of the drag.

start

{OpenLayers.Pixel} The first pixel location of the drag.

oldOnselectstart

{Function}

Constructor

OpenLayers. Handler.Drag

Returns OpenLayers.Handler.Drag

Parameters

control{OpenLayers.Control} The control that is making use of this handler.  If a handler is being used without a control, the handlers setMap method must be overridden to deal properly with the map.
callbacks{Object} An object containing a single function to be called when the drag operation is finished.  The callback should expect to recieve a single argument, the pixel location of the event.  Callbacks for ‘move’ and ‘done’ are supported.  You can also speficy callbacks for ‘down’, ‘up’, and ‘out’ to respond to those events.
options{Object}

Functions

down

down: function(evt)

This method is called during the handling of the mouse down event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse down event

move

move: function(evt)

This method is called during the handling of the mouse move event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse move event

up

up: function(evt)

This method is called during the handling of the mouse up event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse up event

out

out: function(evt)

This method is called during the handling of the mouse out event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse out event

mousedown

mousedown: function (evt)

Handle mousedown events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

mousemove

mousemove: function (evt)

Handle mousemove events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

mouseup

mouseup: function (evt)

Handle mouseup events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

mouseout

mouseout: function (evt)

Handle mouseout events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

click

click: function (evt)

The drag handler captures the click event.  If something else registers for clicks on the same element, its listener will not be called after a drag.

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

activate

activate: function()

Activate the handler.

Returns

{Boolean} The handler was successfully activated.

deactivate

deactivate: function()

Deactivate the handler.

Returns

{Boolean} The handler was successfully deactivated.

This class represents a screen coordinate, in x and y coordinates
down: function(evt)
This method is called during the handling of the mouse down event.
move: function(evt)
This method is called during the handling of the mouse move event.
up: function(evt)
This method is called during the handling of the mouse up event.
out: function(evt)
This method is called during the handling of the mouse out event.
mousedown: function (evt)
Handle mousedown events
mousemove: function (evt)
Handle mousemove events
mouseup: function (evt)
Handle mouseup events
mouseout: function (evt)
Handle mouseout events
click: function (evt)
The drag handler captures the click event.
activate: function()
Activate the handler.
deactivate: function()
Deactivate the handler.
Returns OpenLayers.Handler.Drag
Base class to construct a higher-level handler for event sequences.
Controls affect the display or behavior of the map.