Changeset 5974
- Timestamp:
- 02/03/08 12:10:03 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Control/ModifyFeature.js
r5897 r5974 429 429 */ 430 430 resetVertices: function() { 431 // if coming from a drag complete we're about to destroy the vertex 432 // that was just dragged. For that reason, the drag feature control 433 // will never detect a mouse-out on that vertex, meaning that the drag 434 // handler won't be deactivated. This can cause errors because the drag 435 // feature control still has a feature to drag but that feature is 436 // destroyed. To prevent this, we call outFeature on the drag feature 437 // control if the control actually has a feature to drag. 438 if(this.dragControl.feature) { 439 this.dragControl.outFeature(this.dragControl.feature); 440 } 431 441 if(this.vertices.length > 0) { 432 442 this.layer.removeFeatures(this.vertices); trunk/openlayers/tests/Control/test_ModifyFeature.html
r5623 r5974 250 250 251 251 function test_ModifyFeature_resetVertices(t) { 252 t.plan(1 7);252 t.plan(18); 253 253 var layer = new OpenLayers.Layer.Vector(); 254 254 var control = new OpenLayers.Control.ModifyFeature(layer); … … 300 300 t.eq(control.vertices.length, 3, "Correct vertices length with polygon (RESHAPE | RESIZE)"); 301 301 t.eq(control.virtualVertices.length, 3, "Correct virtual vertices length (RESHAPE | RESIZE)"); 302 303 control.dragControl.feature = new OpenLayers.Feature.Vector(polygon); 304 control.dragControl.map = {}; 305 control.dragControl.map.div = {}; 306 control.dragControl.map.div.style = {}; 307 control.dragControl.map.div.cursor = "foo"; 308 control.dragControl.dragHandler.deactivate = function() { 309 this.active = false; 310 } 311 control.resetVertices(); 312 t.ok(!control.dragControl.dragHandler.active, "resetVertices deactivates drag handler"); 313 control.dragControl.map = null; 314 315 control.destroy(); 316 layer.destroy(); 302 317 } 303 318
