aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/selection-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-xjs/controllers/selection-controller.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index c4623d3f..c713b6e5 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 }
@@ -76,7 +77,7 @@ exports.SelectionController = Montage.create(Component, {
76 77
77 78
78 this.application.ninja.selectedElements = currentSelectionArray; 79 this.application.ninja.selectedElements = currentSelectionArray;
79 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 80 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument});
80 81
81 82
82 83
@@ -89,15 +90,17 @@ 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} );
99 } 103 }
100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
101 } 104 }
102 }, 105 },
103 106
@@ -137,7 +140,7 @@ exports.SelectionController = Montage.create(Component, {
137 value: function(event) { 140 value: function(event) {
138 this.application.ninja.selectedElements = []; 141 this.application.ninja.selectedElements = [];
139 this._isDocument = true; 142 this._isDocument = true;
140 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 143 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument});
141 } 144 }
142 }, 145 },
143 146