Changeset 4063
- Timestamp:
- 08/27/07 17:03:28 (1 year ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Handler/Path.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Handler/Point.js (modified) (2 diffs)
- trunk/openlayers/tests/Handler/test_Path.html (modified) (1 diff)
- trunk/openlayers/tests/Handler/test_Point.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Handler/Path.js
r4036 r4063 79 79 */ 80 80 destroyFeature: function() { 81 OpenLayers.Handler.Point.prototype.destroyFeature.apply(this); 81 82 this.line.destroy(); 82 this. point.destroy();83 this.line = null; 83 84 }, 84 85 trunk/openlayers/lib/OpenLayers/Handler/Point.js
r4036 r4063 117 117 this.map.removeLayer(this.layer, false); 118 118 this.layer.destroy(); 119 this.layer = null; 119 120 return true; 120 121 }, … … 126 127 destroyFeature: function() { 127 128 this.point.destroy(); 129 this.point = null; 128 130 }, 129 131 trunk/openlayers/tests/Handler/test_Path.html
r4059 r4063 67 67 } 68 68 69 function test_Handler_Path_destroy(t) { 70 t.plan(6); 71 var map = new OpenLayers.Map('map'); 72 map.addLayer(new OpenLayers.Layer.WMS("", "", {})); 73 map.zoomToMaxExtent(); 74 var control = new OpenLayers.Control(); 75 map.addControl(control); 76 var handler = new OpenLayers.Handler.Path(control, {foo: 'bar'}); 77 78 handler.activate(); 79 var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1}; 80 handler.mousedown(evt); 81 82 t.ok(handler.layer, 83 "handler has a layer prior to destroy"); 84 t.ok(handler.point, 85 "handler has a point prior to destroy"); 86 t.ok(handler.line, 87 "handler has a line prior to destroy"); 88 handler.destroy(); 89 t.eq(handler.layer, null, 90 "handler.layer is null after destroy"); 91 t.eq(handler.point, null, 92 "handler.point is null after destroy"); 93 t.eq(handler.line, null, 94 "handler.line is null after destroy"); 95 } 69 96 70 97 trunk/openlayers/tests/Handler/test_Point.html
r4059 r4063 63 63 } 64 64 65 function test_Handler_Point_destroy(t) { 66 t.plan(4); 67 var map = new OpenLayers.Map('map'); 68 map.addLayer(new OpenLayers.Layer.WMS("", "", {})); 69 map.zoomToMaxExtent(); 70 var control = new OpenLayers.Control(); 71 map.addControl(control); 72 var handler = new OpenLayers.Handler.Point(control, {foo: 'bar'}); 73 74 handler.activate(); 75 var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1}; 76 handler.mousedown(evt); 77 78 t.ok(handler.layer, 79 "handler has a layer prior to destroy"); 80 t.ok(handler.point, 81 "handler has a point prior to destroy"); 82 handler.destroy(); 83 t.eq(handler.layer, null, 84 "handler.layer is null after destroy"); 85 t.eq(handler.point, null, 86 "handler.point is null after destroy"); 87 } 65 88 66 89
