aboutsummaryrefslogtreecommitdiff
path: root/js/document/html-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-xjs/document/html-document.js48
1 files changed, 39 insertions, 9 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 5d507476..e40656a3 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
@@ -715,6 +736,11 @@ exports.HTMLDocument = Montage.create(TextDocument, {
715 } 736 }
716 737
717 this.draw3DGrid = this.application.ninja.appModel.show3dGrid; 738 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
739
740 //persist a clone of history per document
741 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0);
742 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0);
743 this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start
718 } 744 }
719 }, 745 },
720 746
@@ -724,20 +750,24 @@ exports.HTMLDocument = Montage.create(TextDocument, {
724 value: function () { 750 value: function () {
725 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; 751 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
726 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; 752 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
727 753
728 if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){ 754 if((this.savedLeftScroll !== null) && (this.savedTopScroll !== null)){
729 this.application.ninja.selectedElements = this.selectionModel.slice(0);
730 }
731
732 if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){
733 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll; 755 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll;
734 this.application.ninja.stage._scrollLeft = this.savedLeftScroll;
735 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll; 756 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll;
736 this.application.ninja.stage._scrollLeft = this.savedTopScroll; 757 this.application.ninja.stage.handleScroll();
758 }
759
760 this.application.ninja.currentSelectedContainer = this.documentRoot;
761 if(this.selectionModel){
762 this.application.ninja.selectedElements = this.selectionModel.slice(0);
737 } 763 }
738 this.application.ninja.stage.handleScroll();
739 764
740 this.application.ninja.appModel.show3dGrid = this.draw3DGrid; 765 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
766
767 this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0);
768 this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0);
769
770
741 } 771 }
742 } 772 }
743 //////////////////////////////////////////////////////////////////// 773 ////////////////////////////////////////////////////////////////////