add onEnter and onLeave callback functions to the DragFeature control, p=adube, r=me (closes #3034)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11071 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-02-08 20:47:23 +00:00
parent 198b3a9c7f
commit 9495c8cb70
2 changed files with 42 additions and 5 deletions

View File

@@ -65,6 +65,28 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
*/
onComplete: function(feature, pixel) {},
/**
* APIProperty: 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.
*/
onEnter: function(feature) {},
/**
* APIProperty: 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.
*/
onLeave: function(feature) {},
/**
* APIProperty: documentDrag
* {Boolean} If set to true, mouse dragging will continue even if the
@@ -192,6 +214,7 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
this.handlers.drag.activate();
this.over = true;
OpenLayers.Element.addClass(this.map.viewPortDiv, this.displayClass + "Over");
this.onEnter(feature);
} else {
if(this.feature.id == feature.id) {
this.over = true;
@@ -269,6 +292,7 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Element.removeClass(
this.map.viewPortDiv, this.displayClass + "Over"
);
this.onLeave(feature);
this.feature = null;
} else {
if(this.feature.id == feature.id) {