OpenLayers.Control.DragFeature

The DragFeature control moves a feature with a drag of the mouse.  Create a new control with the OpenLayers.Control.DragFeature constructor.

Inherits From

Summary
OpenLayers.Control.DragFeatureThe DragFeature control moves a feature with a drag of the mouse.
Properties
geometryTypes{Array(String)} To restrict dragging to a limited set of geometry types, send a list of strings corresponding to the geometry class names.
onStart{Function} Define this function if you want to know when a drag starts.
onDrag{Function} Define this function if you want to know about each move of a feature.
onComplete{Function} Define this function if you want to know when a feature is done dragging.
onEnter{Function} Define this function if you want to know when the mouse goes over a feature and thereby makes this feature a candidate for dragging.
onLeave{Function} Define this function if you want to know when the mouse goes out of the feature that was dragged.
documentDrag{Boolean} If set to true, mouse dragging will continue even if the mouse cursor leaves the map viewport.
layer{OpenLayers.Layer.Vector}
feature{OpenLayers.Feature.Vector}
dragCallbacks{Object} The functions that are sent to the drag handler for callback.
featureCallbacks{Object} The functions that are sent to the feature handler for callback.
lastPixel{OpenLayers.Pixel}
Constructor
OpenLayers.Control.DragFeatureCreate a new control to drag features.
Functions
clickFeatureCalled when the feature handler detects a click-in on a feature.
clickoutFeatureCalled when the feature handler detects a click-out on a feature.
destroyTake care of things that are not handled in superclass
activateActivate the control and the feature handler.
deactivateDeactivate the control and all handlers.
overFeatureCalled when the feature handler detects a mouse-over on a feature.
downFeatureCalled when the drag handler detects a mouse-down.
moveFeatureCalled when the drag handler detects a mouse-move.
upFeatureCalled when the drag handler detects a mouse-up.
doneDraggingCalled when the drag handler is done dragging.
outFeatureCalled when the feature handler detects a mouse-out on a feature.
cancelCalled when the drag handler detects a mouse-out (from the map viewport).
setMapSet the map property for the control and all handlers.

Properties

geometryTypes

{Array(String)} To restrict dragging to a limited set of geometry types, send a list of strings corresponding to the geometry class names.

onStart

{Function} Define this function if you want to know when a drag starts.  The function should expect to receive two arguments: the feature that is about to be dragged and the pixel location of the mouse.

Parameters

feature{OpenLayers.Feature.Vector} The feature that is about to be dragged.
pixel{OpenLayers.Pixel} The pixel location of the mouse.

onDrag

{Function} Define this function if you want to know about each move of a feature.  The function should expect to receive two arguments: the feature that is being dragged and the pixel location of the mouse.

Parameters

feature{OpenLayers.Feature.Vector} The feature that was dragged.
pixel{OpenLayers.Pixel} The pixel location of the mouse.

onComplete

{Function} Define this function if you want to know when a feature is done dragging.  The function should expect to receive two arguments: the feature that is being dragged and the pixel location of the mouse.

Parameters

feature{OpenLayers.Feature.Vector} The feature that was dragged.
pixel{OpenLayers.Pixel} The pixel location of the mouse.

onEnter

{Function} Define this function if you want to know when the mouse goes over a feature and thereby makes this feature a candidate for dragging.

Parameters

feature{OpenLayers.Feature.Vector} The feature that is ready to be dragged.

onLeave

{Function} Define this function if you want to know when the mouse goes out of the feature that was dragged.

Parameters

feature{OpenLayers.Feature.Vector} The feature that was dragged.

documentDrag

{Boolean} If set to true, mouse dragging will continue even if the mouse cursor leaves the map viewport.  Default is false.

dragCallbacks

{Object} The functions that are sent to the drag handler for callback.

featureCallbacks

{Object} The functions that are sent to the feature handler for callback.

lastPixel

Constructor

OpenLayers.Control.DragFeature

Create a new control to drag features.

Parameters

layer{OpenLayers.Layer.Vector} The layer containing features to be dragged.
options{Object} Optional object whose properties will be set on the control.

Functions

clickFeature

clickFeature: function(feature)

Called when the feature handler detects a click-in on a feature.

Parameters

feature{OpenLayers.Feature.Vector}

clickoutFeature

clickoutFeature: function(feature)

Called when the feature handler detects a click-out on a feature.

Parameters

feature{OpenLayers.Feature.Vector}

destroy

destroy: function()

Take care of things that are not handled in superclass

activate

activate: function()

Activate the control and the feature handler.

Returns

{Boolean} Successfully activated the control and feature handler.

deactivate

deactivate: function()

Deactivate the control and all handlers.

Returns

{Boolean} Successfully deactivated the control.

overFeature

overFeature: function(feature)

Called when the feature handler detects a mouse-over on a feature.  This activates the drag handler.

Parameters

feature{OpenLayers.Feature.Vector} The selected feature.

Returns

{Boolean} Successfully activated the drag handler.

downFeature

downFeature: function(pixel)

Called when the drag handler detects a mouse-down.

Parameters

pixel{OpenLayers.Pixel} Location of the mouse event.

moveFeature

moveFeature: function(pixel)

Called when the drag handler detects a mouse-move.  Also calls the optional onDrag method.

Parameters

pixel{OpenLayers.Pixel} Location of the mouse event.

upFeature

upFeature: function(pixel)

Called when the drag handler detects a mouse-up.

Parameters

pixel{OpenLayers.Pixel} Location of the mouse event.

doneDragging

doneDragging: function(pixel)

Called when the drag handler is done dragging.

Parameters

pixel{OpenLayers.Pixel} The last event pixel location.  If this event came from a mouseout, this may not be in the map viewport.

outFeature

outFeature: function(feature)

Called when the feature handler detects a mouse-out on a feature.

Parameters

feature{OpenLayers.Feature.Vector} The feature that the mouse left.

cancel

cancel: function()

Called when the drag handler detects a mouse-out (from the map viewport).

setMap

setMap: function(map)

Set the map property for the control and all handlers.

Parameters

map{OpenLayers.Map} The control’s map.
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
Vector features use the OpenLayers.Geometry classes as geometry description.
This class represents a screen coordinate, in x and y coordinates
clickFeature: function(feature)
Called when the feature handler detects a click-in on a feature.
clickoutFeature: function(feature)
Called when the feature handler detects a click-out on a feature.
destroy: function()
Take care of things that are not handled in superclass
activate: function()
Activate the control and the feature handler.
deactivate: function()
Deactivate the control and all handlers.
overFeature: function(feature)
Called when the feature handler detects a mouse-over on a feature.
downFeature: function(pixel)
Called when the drag handler detects a mouse-down.
moveFeature: function(pixel)
Called when the drag handler detects a mouse-move.
upFeature: function(pixel)
Called when the drag handler detects a mouse-up.
doneDragging: function(pixel)
Called when the drag handler is done dragging.
outFeature: function(feature)
Called when the feature handler detects a mouse-out on a feature.
cancel: function()
Called when the drag handler detects a mouse-out (from the map viewport).
setMap: function(map)
Set the map property for the control and all handlers.
Create a new control to drag features.
Controls affect the display or behavior of the map.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Close