Refactor Hanadler.Point cancel/finalize to just call a cleanup and pass a

callback type, since otherwise they're the same thing. From sbenthall, r=me
(Closes #1332) 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6154 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-02-09 00:49:38 +00:00
parent de13a7f91f
commit 60706fc3f9

View File

@@ -151,13 +151,7 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
* Finish the geometry and call the "done" callback.
*/
finalize: function() {
this.layer.renderer.clear();
this.drawing = false;
this.mouseDown = false;
this.lastDown = null;
this.lastUp = null;
this.callback("done", [this.geometryClone()]);
this.destroyFeature();
this.cleanup("done");
},
/**
@@ -165,12 +159,15 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
* Finish the geometry and call the "cancel" callback.
*/
cancel: function() {
this.layer.renderer.clear();
this.drawing = false;
this.cleanup("cancel");
},
cleanup: function(callback) {
this.layer.eraseFeatures(this.point);
this.mouseDown = false;
this.lastDown = null;
this.lastUp = null;
this.callback("cancel", [this.geometryClone()]);
this.callback(callback, [this.geometryClone()]);
this.destroyFeature();
},