The modify feature control destroys the vertex that was dragged in the drag

complete callback. Thus, the drag feature control won't detect a mouse-out on
that vertex and won't deactivate its drag handler. This causes errors because
the drag feature control has a feature to drag but that feature is destroyed
(feature.geometry is null). To prevent this, we make resetVertices explicitely
call outFeature on the drag feature control if the control has a feature to
drag. tschaub did most of the investigation on the problem. r=tschaub,me
(closes #1235)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5974 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2008-02-03 17:10:03 +00:00
parent 5a176d7852
commit 3acc19ae3d
2 changed files with 26 additions and 1 deletions

View File

@@ -428,6 +428,16 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* Method: resetVertices
*/
resetVertices: function() {
// if coming from a drag complete we're about to destroy the vertex
// that was just dragged. For that reason, the drag feature control
// will never detect a mouse-out on that vertex, meaning that the drag
// handler won't be deactivated. This can cause errors because the drag
// feature control still has a feature to drag but that feature is
// destroyed. To prevent this, we call outFeature on the drag feature
// control if the control actually has a feature to drag.
if(this.dragControl.feature) {
this.dragControl.outFeature(this.dragControl.feature);
}
if(this.vertices.length > 0) {
this.layer.removeFeatures(this.vertices);
this.vertices = [];