From 60706fc3f96c6eb9c76d722bd44d4de2ff8ec8c8 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sat, 9 Feb 2008 00:49:38 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Handler/Point.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/OpenLayers/Handler/Point.js b/lib/OpenLayers/Handler/Point.js index 79e67b28b8..c04ebcb4d0 100644 --- a/lib/OpenLayers/Handler/Point.js +++ b/lib/OpenLayers/Handler/Point.js @@ -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(); },