From 8007298d7b035f456801d2f476c0b57f801c1676 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 1 Nov 2007 23:06:10 +0000 Subject: [PATCH] Dissalow vertex deletion while dragging - thanks for the review crschmidt (closes #1122). git-svn-id: http://svn.openlayers.org/trunk/openlayers@5099 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/ModifyFeature.js | 3 ++- tests/Control/test_ModifyFeature.html | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Control/ModifyFeature.js b/lib/OpenLayers/Control/ModifyFeature.js index 9792569601..8f46d3e1ec 100644 --- a/lib/OpenLayers/Control/ModifyFeature.js +++ b/lib/OpenLayers/Control/ModifyFeature.js @@ -384,7 +384,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) { var vertex = this.dragControl.feature; if(vertex && - OpenLayers.Util.indexOf(this.vertices, vertex) != -1) { + OpenLayers.Util.indexOf(this.vertices, vertex) != -1 && + !this.dragControl.dragHandler.dragging) { // remove the vertex vertex.geometry.parent.removeComponent(vertex.geometry); this.layer.drawFeature(this.feature, diff --git a/tests/Control/test_ModifyFeature.html b/tests/Control/test_ModifyFeature.html index 7e47c25970..5f7ee9e262 100644 --- a/tests/Control/test_ModifyFeature.html +++ b/tests/Control/test_ModifyFeature.html @@ -168,6 +168,11 @@ // run the above four tests twice control.handleKeypress(delKey); control.handleKeypress(dKey); + + // now make sure nothing happens if the vertex is mid-drag + control.dragControl.dragHandler.dragging = true; + control.handleKeypress(delKey); + // reset modified methods control.onModification = function() {};