drag feature support on mobile. r=erilem (closes #3231)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11845 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -151,6 +151,10 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
),
|
||||
feature: new OpenLayers.Handler.Feature(
|
||||
this, this.layer, OpenLayers.Util.extend({
|
||||
// 'click' and 'clickout' callback are for the mobile
|
||||
// support: no 'over' or 'out' in touch based browsers.
|
||||
click: this.clickFeature,
|
||||
clickout: this.clickoutFeature,
|
||||
over: this.overFeature,
|
||||
out: this.outFeature
|
||||
}, this.featureCallbacks),
|
||||
@@ -158,7 +162,34 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
)
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: clickFeature
|
||||
* Called when the feature handler detects a click-in on a feature.
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
clickFeature: function(feature) {
|
||||
if (this.overFeature(feature)) {
|
||||
this.handlers.drag.dragstart(this.handlers.feature.evt);
|
||||
// to let the events propagate to the feature handler (click callback)
|
||||
this.handlers.drag.stopDown = false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: clickoutFeature
|
||||
* Called when the feature handler detects a click-out on a feature.
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
clickoutFeature: function(feature) {
|
||||
this.outFeature(feature);
|
||||
this.handlers.drag.stopDown = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: destroy
|
||||
* Take care of things that are not handled in superclass
|
||||
@@ -207,11 +238,16 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>} The selected feature.
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean} Successfully activated the drag handler.
|
||||
*/
|
||||
overFeature: function(feature) {
|
||||
var activated = false;
|
||||
if(!this.handlers.drag.dragging) {
|
||||
this.feature = feature;
|
||||
this.handlers.drag.activate();
|
||||
activated = true;
|
||||
this.over = true;
|
||||
OpenLayers.Element.addClass(this.map.viewPortDiv, this.displayClass + "Over");
|
||||
this.onEnter(feature);
|
||||
@@ -222,6 +258,7 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.over = false;
|
||||
}
|
||||
}
|
||||
return activated;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user