OpenLayers OpenLayers

Changeset 4392

Show
Ignore:
Timestamp:
09/19/07 09:12:20 (1 year ago)
Author:
tcoulter
Message:

UndoRedo's current state. It's broken, but I need to move between home and work computers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/tcoulter/openlayers/lib/OpenLayers/Control/UndoRedo.js

    r4387 r4392  
    138138            if (this.featureUndoStack.length == 0) return; 
    139139             
    140             currentFeatureId = this.featureUndoStack.pop(); 
    141             currentFeatureUndoStack = this.featureUndoHash[currentFeatureId]             
    142             currentFeature = currentFeatureUndoStack.pop(); 
    143            
    144             currentFeature.layer.eraseFeatures(currentFeature); 
    145             this.featureRedoStack.push(currentFeature); 
     140            currentFeature = this.featureUndoStack.pop(); 
     141            currentFeatureUndoStack = this.featureUndoHash[currentFeature.id]             
     142            currentGeometry = currentFeatureUndoStack.pop(); 
     143            currentFeature.layer.removeFeatures(currentFeature) 
     144           
     145            if (currentFeatureUndoStack.length == 0) return; 
     146           
     147            //alert(currentFeatureUndoStack[currentFeatureUndoStack.length-1]) 
     148            var feature = new OpenLayers.Feature.Vector(currentFeatureUndoStack[currentFeatureUndoStack.length-1]); 
     149            feature.id = currentFeature.id 
     150            currentFeature.layer.addFeatures(feature) 
     151            //currentFeature.layer.drawFeature(feature) 
     152           
     153           
     154            //this.featureRedoStack.push(geometry); 
    146155             
    147             if (currentFeatureUndoStack.length == 0) return; 
    148              
    149             nextFeature = currentFeatureUndoStack[currentFeatureUndoStack.length-1] 
    150             nextFeature.layer.drawFeature(nextFeature, null); 
     156            
    151157        } 
    152158        else if (this.isValidRedo(this.keydownStack)) 
     
    194200//            existingFeature.layer.removeFeatures(existingFeature); 
    195201//        } 
    196         clone = feature.clone 
    197         clone.layer = feature.layer 
    198         //clone.geometry = feature.geometry.clone 
    199202         
    200203        if (this.featureUndoHash[feature.id] == null) this.featureUndoHash[feature.id] = [] 
    201204                 
    202         this.featureUndoStack.push(feature.id); 
    203         this.featureUndoHash[feature.id].push(clone) 
     205        this.featureUndoStack.push(feature); 
     206        this.featureUndoHash[feature.id].push(feature.geometry.clone) 
    204207    }, 
    205208