diff options
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-x | js/controllers/selection-controller.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 75968d4a..53cca029 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | 7 | ||
8 | var Montage = require("montage/core/core").Montage, | 8 | var Montage = require("montage/core/core").Montage, |
9 | Component = require("montage/ui/component").Component; | 9 | Component = require("montage/ui/component").Component, |
10 | NJUtils = require("js/lib/NJUtils").NJUtils; | ||
10 | 11 | ||
11 | exports.SelectionController = Montage.create(Component, { | 12 | exports.SelectionController = Montage.create(Component, { |
12 | 13 | ||
@@ -48,6 +49,7 @@ exports.SelectionController = Montage.create(Component, { | |||
48 | this.eventManager.addEventListener("selectAll", this, false); | 49 | this.eventManager.addEventListener("selectAll", this, false); |
49 | this.eventManager.addEventListener("deleteSelection", this, false); | 50 | this.eventManager.addEventListener("deleteSelection", this, false); |
50 | this.eventManager.addEventListener("switchDocument", this, false); | 51 | this.eventManager.addEventListener("switchDocument", this, false); |
52 | this.eventManager.addEventListener("closeDocument", this, false); | ||
51 | // defaultEventManager.addEventListener( "undo", this, false); | 53 | // defaultEventManager.addEventListener( "undo", this, false); |
52 | // defaultEventManager.addEventListener( "redo", this, false); | 54 | // defaultEventManager.addEventListener( "redo", this, false); |
53 | } | 55 | } |
@@ -91,15 +93,11 @@ exports.SelectionController = Montage.create(Component, { | |||
91 | 93 | ||
92 | handleSwitchDocument: { | 94 | handleSwitchDocument: { |
93 | value: function() { | 95 | value: function() { |
94 | this._selectedItems = this.application.ninja.selectedElements.slice(0); | 96 | if(this.application.ninja.documentController.activeDocument.currentView === "design"){ |
95 | if(this._selectedItems.length === 0) { | 97 | this._selectedItems = this.application.ninja.selectedElements.slice(0); |
96 | this._isDocument = true; | 98 | this._isDocument = this._selectedItems.length === 0; |
97 | } else { | 99 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); |
98 | this._isDocument = false; | ||
99 | } | 100 | } |
100 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); | ||
101 | |||
102 | this._selectionContainer = this.application.ninja.currentSelectedContainer; | ||
103 | } | 101 | } |
104 | }, | 102 | }, |
105 | 103 | ||
@@ -114,6 +112,15 @@ exports.SelectionController = Montage.create(Component, { | |||
114 | if(!this._isDocument) { | 112 | if(!this._isDocument) { |
115 | if(this.findSelectedElement(event.detail) !== -1) { | 113 | if(this.findSelectedElement(event.detail) !== -1) { |
116 | this.executeSelectElement(); | 114 | this.executeSelectElement(); |
115 | var element = event.detail; | ||
116 | if (element) { | ||
117 | if (element.elementModel) { | ||
118 | if (element.elementModel.shapeModel) { | ||
119 | if (element.elementModel.shapeModel.GLWorld) | ||
120 | element.elementModel.shapeModel.GLWorld.clearTree(); | ||
121 | } | ||
122 | } | ||
123 | } | ||
117 | } | 124 | } |
118 | } | 125 | } |
119 | } | 126 | } |