aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js52
1 files changed, 44 insertions, 8 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 76436732..544c0ad5 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
@@ -677,8 +698,15 @@ exports.HTMLDocument = Montage.create(TextDocument, {
677 this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; 698 this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
678 699
679 if(typeof this.application.ninja.selectedElements !== 'undefined'){ 700 if(typeof this.application.ninja.selectedElements !== 'undefined'){
680 this.selectionModel = this.application.ninja.selectedElements; 701 this.selectionModel = this.application.ninja.selectedElements.slice(0);
681 } 702 }
703
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
682 } 710 }
683 }, 711 },
684 712
@@ -689,17 +717,25 @@ exports.HTMLDocument = Montage.create(TextDocument, {
689 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; 717 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
690 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; 718 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
691 719
692 if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null) && (this.selectionModel.length > 0)){
693 this.application.ninja.selectionController.initWithDocument(this.selectionModel);
694 }
695 720
696 if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){ 721
722 if((this.savedLeftScroll !== null) && (this.savedTopScroll !== null)){
697 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll; 723 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll;
698 this.application.ninja.stage._scrollLeft = this.savedLeftScroll;
699 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll; 724 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll;
700 this.application.ninja.stage._scrollLeft = this.savedTopScroll; 725 this.application.ninja.stage.handleScroll();
726 }
727
728 this.application.ninja.currentSelectedContainer = this.documentRoot;
729 if(this.selectionModel){
730 this.application.ninja.selectedElements = this.selectionModel.slice(0);
701 } 731 }
702 this.application.ninja.stage.handleScroll(); 732
733 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
734
735 this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0);
736 this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0);
737
738
703 } 739 }
704 } 740 }
705 //////////////////////////////////////////////////////////////////// 741 ////////////////////////////////////////////////////////////////////