diff options
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-x | js/controllers/selection-controller.js | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 75968d4a..eff9c91a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -48,6 +48,7 @@ exports.SelectionController = Montage.create(Component, { | |||
48 | this.eventManager.addEventListener("selectAll", this, false); | 48 | this.eventManager.addEventListener("selectAll", this, false); |
49 | this.eventManager.addEventListener("deleteSelection", this, false); | 49 | this.eventManager.addEventListener("deleteSelection", this, false); |
50 | this.eventManager.addEventListener("switchDocument", this, false); | 50 | this.eventManager.addEventListener("switchDocument", this, false); |
51 | this.eventManager.addEventListener("closeDocument", this, false); | ||
51 | // defaultEventManager.addEventListener( "undo", this, false); | 52 | // defaultEventManager.addEventListener( "undo", this, false); |
52 | // defaultEventManager.addEventListener( "redo", this, false); | 53 | // defaultEventManager.addEventListener( "redo", this, false); |
53 | } | 54 | } |
@@ -89,17 +90,31 @@ exports.SelectionController = Montage.create(Component, { | |||
89 | } | 90 | } |
90 | }, | 91 | }, |
91 | 92 | ||
92 | handleSwitchDocument: { | 93 | handleSwitchDocument: { |
93 | value: function() { | 94 | value: function() { |
94 | this._selectedItems = this.application.ninja.selectedElements.slice(0); | 95 | if(this.application.ninja.documentController.activeDocument.currentView === "design"){ |
95 | if(this._selectedItems.length === 0) { | 96 | this._selectedItems = this.application.ninja.selectedElements.slice(0); |
96 | this._isDocument = true; | 97 | if(this._selectedItems.length === 0 ){ |
97 | } else { | 98 | this._isDocument = true; |
98 | this._isDocument = false; | 99 | }else{ |
100 | this._isDocument = false; | ||
101 | } | ||
102 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); | ||
103 | |||
104 | this._selectionContainer = this.application.ninja.currentSelectedContainer; | ||
99 | } | 105 | } |
100 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); | 106 | } |
107 | }, | ||
101 | 108 | ||
102 | this._selectionContainer = this.application.ninja.currentSelectedContainer; | 109 | handleCloseDocument:{ |
110 | value: function() { | ||
111 | //clear selections if all documents are closed | ||
112 | if(this.application.ninja.documentController._documents.length === 0){ | ||
113 | this._selectedItems.length =0; | ||
114 | this.application.ninja.selectedElements.length =0; | ||
115 | this._isDocument = true; | ||
116 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); | ||
117 | } | ||
103 | } | 118 | } |
104 | }, | 119 | }, |
105 | 120 | ||