aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorAnanya Sen2012-02-27 17:39:26 -0800
committerAnanya Sen2012-02-27 17:39:26 -0800
commit2edcdd88ffc2f6ff0ea836e4da3e1fd2cb3e856f (patch)
tree18361c8889884ed9c4eb687182ac42afb0d0f13d /js/document
parent51ed781953bc44bba3c70938aa57b856394cbc88 (diff)
downloadninja-2edcdd88ffc2f6ff0ea836e4da3e1fd2cb3e856f.tar.gz
persist undo/redo stack per html document
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 75628731..111c491d 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -59,6 +59,27 @@ exports.HTMLDocument = Montage.create(TextDocument, {
59 _gridVerticalSpacing: {value:0}, 59 _gridVerticalSpacing: {value:0},
60 //end - drawUtils state 60 //end - drawUtils state
61 61
62 _undoStack: { value: [] },
63 undoStack: {
64 get: function() {
65 return this._undoStack;
66 },
67 set:function(value){
68 this._undoStack = value;
69 }
70 },
71
72 _redoStack: { value: [], enumerable: false },
73
74 redoStack: {
75 get: function() {
76 return this._redoStack;
77 },
78 set:function(value){
79 this._redoStack = value;
80 }
81 },
82
62 83
63 // GETTERS / SETTERS 84 // GETTERS / SETTERS
64 85
@@ -681,6 +702,11 @@ exports.HTMLDocument = Montage.create(TextDocument, {
681 } 702 }
682 703
683 this.draw3DGrid = this.application.ninja.appModel.show3dGrid; 704 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
705
706 //persist a clone of history per document
707 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0);
708 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0);
709 this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start
684 } 710 }
685 }, 711 },
686 712
@@ -704,6 +730,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
704 this.application.ninja.stage.handleScroll(); 730 this.application.ninja.stage.handleScroll();
705 731
706 this.application.ninja.appModel.show3dGrid = this.draw3DGrid; 732 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
733
734 this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0);
735 this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0);
707 } 736 }
708 } 737 }
709 //////////////////////////////////////////////////////////////////// 738 ////////////////////////////////////////////////////////////////////