diff options
author | hwc487 | 2012-06-12 15:52:35 -0700 |
---|---|---|
committer | hwc487 | 2012-06-12 15:52:35 -0700 |
commit | 9490f816924e9e9c9970ef9384241c07ec0a6e9f (patch) | |
tree | f44449a2e0055e21960a5513fb3a0738a91db528 /js/controllers/selection-controller.js | |
parent | b7a41cbd5a30d32f524ee60e2dfdf9c65c7ec55b (diff) | |
parent | 6854a72504f57903bd5de003e377f2aefb02d0da (diff) | |
download | ninja-9490f816924e9e9c9970ef9384241c07ec0a6e9f.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
assets/canvas-runtime.js
js/io/system/ninjalibrary.json
js/mediators/element-mediator.js
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-x | js/controllers/selection-controller.js | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 4bca0755..9ae1cfc9 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -35,7 +35,7 @@ exports.SelectionController = Montage.create(Component, { | |||
35 | 35 | ||
36 | if(this._currentDocument && this._currentDocument.currentView === "design") { | 36 | if(this._currentDocument && this._currentDocument.currentView === "design") { |
37 | this._currentDocument.model._selection = this.application.ninja.selectedElements; | 37 | this._currentDocument.model._selection = this.application.ninja.selectedElements; |
38 | this._currentDocument.model.selectionContainer = this.application.ninja._currentSelectedContainer; | 38 | // this._currentDocument.model.selectionContainer = this.application.ninja._currentSelectedContainer; |
39 | } | 39 | } |
40 | 40 | ||
41 | this._currentDocument = value; | 41 | this._currentDocument = value; |
@@ -65,7 +65,7 @@ exports.SelectionController = Montage.create(Component, { | |||
65 | this._selectedElements = value; | 65 | this._selectedElements = value; |
66 | 66 | ||
67 | this.application.ninja.selectedElements = this._selectedElements; | 67 | this.application.ninja.selectedElements = this._selectedElements; |
68 | this.application.ninja._currentSelectedContainer = this._selectionContainer = this.application.ninja.currentDocument.model.documentRoot; | 68 | // this.application.ninja._currentSelectedContainer = this._selectionContainer = this.application.ninja.currentDocument.model.documentRoot; |
69 | 69 | ||
70 | if(this._selectedElements.length === 0) { | 70 | if(this._selectedElements.length === 0) { |
71 | this.executeSelectElement(); | 71 | this.executeSelectElement(); |
@@ -78,30 +78,24 @@ exports.SelectionController = Montage.create(Component, { | |||
78 | } | 78 | } |
79 | }, | 79 | }, |
80 | 80 | ||
81 | // Bound property to the ninja currentSelectedContainer | ||
82 | _selectionContainer: { | ||
83 | value: null | ||
84 | }, | ||
85 | |||
86 | selectionContainer: { | ||
87 | get: function() { | ||
88 | return this._selectionContainer | ||
89 | }, | ||
90 | set: function(value) { | ||
91 | if(this._selectionContainer && this._selectionContainer !== value) { | ||
92 | this.executeSelectElement(); | ||
93 | } | ||
94 | |||
95 | this._selectionContainer = value; | ||
96 | } | ||
97 | }, | ||
98 | |||
99 | deserializedFromTemplate: { | 81 | deserializedFromTemplate: { |
100 | value: function() { | 82 | value: function() { |
101 | this.eventManager.addEventListener("elementAdded", this, false); | 83 | this.eventManager.addEventListener("elementAdded", this, false); |
102 | this.eventManager.addEventListener("elementsRemoved", this, false); | 84 | this.eventManager.addEventListener("elementsRemoved", this, false); |
103 | this.eventManager.addEventListener("elementReplaced", this, false); | 85 | this.eventManager.addEventListener("elementReplaced", this, false); |
104 | this.eventManager.addEventListener("selectAll", this, false); | 86 | this.eventManager.addEventListener("selectAll", this, false); |
87 | |||
88 | this.addPropertyChangeListener("currentDocument.model.domContainer", this); | ||
89 | } | ||
90 | }, | ||
91 | |||
92 | handleChange: { | ||
93 | value: function() { | ||
94 | if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) { | ||
95 | if(this.currentDocument.model.getProperty("domContainer") !== null) { | ||
96 | this.executeSelectElement(); | ||
97 | } | ||
98 | } | ||
105 | } | 99 | } |
106 | }, | 100 | }, |
107 | 101 | ||
@@ -175,12 +169,12 @@ exports.SelectionController = Montage.create(Component, { | |||
175 | if(this.isDocument) return; // If the stage is already selected do nothing. | 169 | if(this.isDocument) return; // If the stage is already selected do nothing. |
176 | this.executeSelectElement(); // Else execute selection with no element | 170 | this.executeSelectElement(); // Else execute selection with no element |
177 | } else { | 171 | } else { |
178 | if(element.parentNode.uuid === this.selectionContainer.uuid) { | 172 | if(element.parentNode.uuid === this.currentDocument.model.domContainer.uuid) { |
179 | this.executeSelectElement(element); | 173 | this.executeSelectElement(element); |
180 | } else { | 174 | } else { |
181 | var outerElement = element.parentNode; | 175 | var outerElement = element.parentNode; |
182 | 176 | ||
183 | while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { | 177 | while(outerElement.parentNode && outerElement.parentNode.uuid !== this.currentDocument.model.domContainer.uuid) { |
184 | // If element is higher up than current container then return | 178 | // If element is higher up than current container then return |
185 | if(outerElement.nodeName === "BODY") return; | 179 | if(outerElement.nodeName === "BODY") return; |
186 | // else keep going up the chain | 180 | // else keep going up the chain |