- Timestamp:
- 2019-03-01T18:23:58+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/map-scripts-editor-history.js
r32799 r32832 10 10 MapEditorHistory.prototype.undo = function () { 11 11 12 for (var i = 0; i < this.mapEditor.overlays.length; i++) { 13 this.mapEditor.overlays[i].setMap(null); 14 } 12 15 13 if (this.prevOverlays.length != 0) { 14 for (var i = 0; i < this.mapEditor.overlays.length; i++) { 15 this.mapEditor.overlays[i].setMap(null); 16 } 17 16 18 this.mapEditor.selectedShapes = []; 17 19 this.mapEditor.overlays = []; … … 34 36 35 37 if (this.undoneOverlays.length != 0) { 36 var draggableCB = document.querySelector("input[name=draggableCB]").checked = false; 37 this.mapEditor.selectedShapes = []; 38 for (var i = 0; i < this.mapEditor.overlays.length; i++) { 39 this.mapEditor.overlays[i].setMap(null); 40 } 41 42 this.mapEditor.overlays = []; 43 var lastEntry = this.undoneOverlays[this.undoneOverlays.length - 1]; 44 for (var i = 0; i < lastEntry.length; i++) { 45 this.mapEditor.overlays[i] = lastEntry[i]; 46 this.mapEditor.overlays[i].setMap(this.mapEditor.map); 47 this.mapEditor.overlays[i].draggable = true; 48 } 49 50 var conditionPrevious = this.presentOverlays[0]; 51 if (conditionPrevious !== undefined) { 52 if (conditionPrevious.length == 0) { 53 this.prevOverlays.push(this.presentOverlays[0]); 54 } else { 55 var overlays_copy = []; 56 for (var i = 0; i < this.presentOverlays[0].length; i++) { 57 var clone_shape = ShapesUtil.cloneShape(this.presentOverlays[0][i]); 58 if (ShapesUtil.overlayItemIsShape(clone_shape)) { 59 this.mapEditor.addShapeListeners(clone_shape, null); 60 } else { 61 this.mapEditor.addMarkerListeners(clone_shape, null); 38 if (this.undoneOverlays[this.undoneOverlays.length -1].length != 0) { 39 var draggableCB = document.querySelector("input[name=draggableCB]").checked = false; 40 this.mapEditor.selectedShapes = []; 41 for (var i = 0; i < this.mapEditor.overlays.length; i++) { 42 this.mapEditor.overlays[i].setMap(null); 43 } 44 45 this.mapEditor.overlays = []; 46 var lastEntry = this.undoneOverlays[this.undoneOverlays.length - 1]; 47 for (var i = 0; i < lastEntry.length; i++) { 48 this.mapEditor.overlays[i] = lastEntry[i]; 49 this.mapEditor.overlays[i].setMap(this.mapEditor.map); 50 this.mapEditor.overlays[i].draggable = true; 51 } 52 53 var conditionPrevious = this.presentOverlays[0]; 54 if (conditionPrevious !== undefined) { 55 if (conditionPrevious.length == 0) { 56 this.prevOverlays.push(this.presentOverlays[0]); 57 } else { 58 var overlays_copy = []; 59 for (var i = 0; i < this.presentOverlays[0].length; i++) { 60 var clone_shape = ShapesUtil.cloneShape(this.presentOverlays[0][i]); 61 if (ShapesUtil.overlayItemIsShape(clone_shape)) { 62 this.mapEditor.addShapeListeners(clone_shape, null); 63 } else { 64 this.mapEditor.addMarkerListeners(clone_shape, null); 65 } 66 overlays_copy[i] = clone_shape; 62 67 } 63 overlays_copy[i] = clone_shape;68 this.prevOverlays.push(overlays_copy); 64 69 } 65 this.prevOverlays.push(overlays_copy); 66 } 67 } 68 this.presentOverlays = []; 69 this.presentOverlays.push(this.undoneOverlays[this.undoneOverlays.length - 1]); 70 this.undoneOverlays.pop(); 70 } 71 this.presentOverlays = []; 72 this.presentOverlays.push(this.undoneOverlays[this.undoneOverlays.length - 1]); 73 this.undoneOverlays.pop(); 74 } 71 75 } 72 76 }
Note:
See TracChangeset
for help on using the changeset viewer.