aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/selection-controller.js2
-rwxr-xr-xjs/controllers/undo-controller.js17
-rwxr-xr-xjs/document/html-document.js48
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js6
4 files changed, 59 insertions, 14 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index c4623d3f..08eb018f 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -98,6 +98,8 @@ exports.SelectionController = Montage.create(Component, {
98 this._isDocument = false; 98 this._isDocument = false;
99 } 99 }
100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
101
102 this._selectionContainer = this.application.ninja.currentSelectedContainer;
101 } 103 }
102 }, 104 },
103 105
diff --git a/js/controllers/undo-controller.js b/js/controllers/undo-controller.js
index 926803d3..19cfb6e6 100755
--- a/js/controllers/undo-controller.js
+++ b/js/controllers/undo-controller.js
@@ -71,22 +71,28 @@ exports.UndoController = Montage.create( Component, {
71 /** 71 /**
72 * Undo Queue 72 * Undo Queue
73 */ 73 */
74 _undoQueue: { value: [] }, 74 _undoQueue: { value: []},
75 75
76 undoQueue: { 76 undoQueue: {
77 get: function() { 77 get: function() {
78 return this._undoQueue; 78 return this._undoQueue;
79 },
80 set: function(value){
81 this._undoQueue = value;
79 } 82 }
80 }, 83 },
81 84
82 /** 85 /**
83 * Redo Queue 86 * Redo Queue
84 */ 87 */
85 _redoQueue: { value: [], enumerable: false }, 88 _redoQueue: { value: [], enumerable: false},
86 89
87 redoQueue: { 90 redoQueue: {
88 get: function() { 91 get: function() {
89 return this._redoQueue; 92 return this._redoQueue;
93 },
94 set: function(value){
95 this._redoQueue = value;
90 } 96 }
91 }, 97 },
92 98
@@ -202,5 +208,12 @@ exports.UndoController = Montage.create( Component, {
202 this.redoQueue.splice(0, this.redoQueue.length); 208 this.redoQueue.splice(0, this.redoQueue.length);
203 //this.redoQueue = []; 209 //this.redoQueue = [];
204 } 210 }
211 },
212
213 clearHistory:{
214 value: function(){
215 this.undoQueue.length = 0;
216 this.redoQueue.length = 0;
217 }
205 } 218 }
206}); \ No newline at end of file 219}); \ No newline at end of file
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 ////////////////////////////////////////////////////////////////////
diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
index 428e7bab..3d99ae4d 100644
--- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
+++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
@@ -861,12 +861,12 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
861 var dataStore = window.sessionStorage; 861 var dataStore = window.sessionStorage;
862 try { 862 try {
863 if(this.pickerModel.pickerMode === "write"){ 863 if(this.pickerModel.pickerMode === "write"){
864 dataStore.setItem('lastSavedFolderURI',escape(""+this.currentURI)); 864 dataStore.setItem('lastSavedFolderURI', encodeURI(""+this.currentURI));
865 } 865 }
866 else if(this.pickerModel.inFileMode === true){ 866 else if(this.pickerModel.inFileMode === true){
867 dataStore.setItem('lastOpenedFolderURI_fileSelection',escape(""+this.currentURI)); 867 dataStore.setItem('lastOpenedFolderURI_fileSelection',encodeURI(""+this.currentURI));
868 }else if(this.pickerModel.inFileMode === false){ 868 }else if(this.pickerModel.inFileMode === false){
869 dataStore.setItem('lastOpenedFolderURI_folderSelection',escape(""+this.currentURI)); 869 dataStore.setItem('lastOpenedFolderURI_folderSelection',encodeURI(""+this.currentURI));
870 } 870 }
871 } 871 }
872 catch(e){ 872 catch(e){