OpenLayers OpenLayers

Changeset 6154

Show
Ignore:
Timestamp:
02/08/08 19:49:38 (7 months ago)
Author:
crschmidt
Message:

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)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Handler/Point.js

    r6011 r6154  
    152152     */ 
    153153    finalize: function() { 
    154         this.layer.renderer.clear(); 
    155         this.drawing = false; 
     154        this.cleanup("done"); 
     155    }, 
     156 
     157    /** 
     158     * APIMethod: cancel 
     159     * Finish the geometry and call the "cancel" callback. 
     160     */ 
     161    cancel: function() { 
     162        this.cleanup("cancel"); 
     163    }, 
     164     
     165    cleanup: function(callback) { 
     166        this.layer.eraseFeatures(this.point); 
    156167        this.mouseDown = false; 
    157168        this.lastDown = null; 
    158169        this.lastUp = null; 
    159         this.callback("done", [this.geometryClone()]); 
    160         this.destroyFeature(); 
    161     }, 
    162  
    163     /** 
    164      * APIMethod: cancel 
    165      * Finish the geometry and call the "cancel" callback. 
    166      */ 
    167     cancel: function() { 
    168         this.layer.renderer.clear(); 
    169         this.drawing = false; 
    170         this.mouseDown = false; 
    171         this.lastDown = null; 
    172         this.lastUp = null; 
    173         this.callback("cancel", [this.geometryClone()]); 
     170        this.callback(callback, [this.geometryClone()]); 
    174171        this.destroyFeature(); 
    175172    },