diff options
author | Valerio Virgillito | 2012-05-10 22:25:26 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-10 22:25:26 -0700 |
commit | e7293b28c53b23e64044c29e8451cbf3fc0bd049 (patch) | |
tree | 895258b824277d4b9be34bc1b8a500c0e8fbe096 /js | |
parent | 90d158a3372b6c8ac2deb8b82070d76135e72397 (diff) | |
download | ninja-e7293b28c53b23e64044c29e8451cbf3fc0bd049.tar.gz |
Partially fixing the body pi and fixing the selection controller
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/selection-controller.js | 17 | ||||
-rwxr-xr-x | js/panels/properties.reel/properties.js | 6 |
2 files changed, 10 insertions, 13 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index a81cdf7f..6e40abb5 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -165,7 +165,7 @@ exports.SelectionController = Montage.create(Component, { | |||
165 | 165 | ||
166 | while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { | 166 | while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { |
167 | // If element is higher up than current container then return | 167 | // If element is higher up than current container then return |
168 | if(outerElement.id === "UserContent") return; | 168 | if(outerElement.nodeName === "BODY") return; |
169 | // else keep going up the chain | 169 | // else keep going up the chain |
170 | outerElement = outerElement.parentNode; | 170 | outerElement = outerElement.parentNode; |
171 | } | 171 | } |
@@ -246,25 +246,20 @@ exports.SelectionController = Montage.create(Component, { | |||
246 | } | 246 | } |
247 | }, | 247 | }, |
248 | 248 | ||
249 | /** | ||
250 | * Looks into the selectionObject for the item to be found using it's id | ||
251 | * | ||
252 | * @return: Item index in the selectionObject if found | ||
253 | * -1 if not found | ||
254 | */ | ||
255 | findSelectedElement: { | 249 | findSelectedElement: { |
256 | value: function(item) { | 250 | value: function(item) { |
257 | // TODO do the loop check in the select element and only use the index here | 251 | // TODO: Remove this function and use the stage selectable. Then only return a match in the array |
258 | // return this.application.ninja.selectedElements.indexOf(item); | 252 | //return this.application.ninja.selectedElements.indexOf(item); |
259 | 253 | ||
254 | //TODO: Make sure we don't need to loop back to the container element. | ||
260 | var itemUUID; | 255 | var itemUUID; |
261 | 256 | ||
262 | for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { | 257 | for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { |
263 | // Check for multiple selection and excluding inner elements | 258 | // Check for multiple selection and excluding inner elements |
264 | if(item.parentNode && item.parentNode.id !== "UserContent") { | 259 | if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.documentRoot) { |
265 | var outerElement = item.parentNode; | 260 | var outerElement = item.parentNode; |
266 | 261 | ||
267 | while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { | 262 | while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.documentRoot) { |
268 | outerElement = outerElement.parentNode; | 263 | outerElement = outerElement.parentNode; |
269 | } | 264 | } |
270 | 265 | ||
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index 8c2daa14..6f43ce03 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js | |||
@@ -78,6 +78,7 @@ exports.Properties = Montage.create(Component, { | |||
78 | if(this.application.ninja.selectedElements.length === 0 && this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() !== "body") { | 78 | if(this.application.ninja.selectedElements.length === 0 && this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() !== "body") { |
79 | this.displayStageProperties(); | 79 | this.displayStageProperties(); |
80 | } | 80 | } |
81 | this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); | ||
81 | } | 82 | } |
82 | }, | 83 | }, |
83 | 84 | ||
@@ -174,8 +175,9 @@ exports.Properties = Montage.create(Component, { | |||
174 | handleSelectionChange: { | 175 | handleSelectionChange: { |
175 | value: function(event) { | 176 | value: function(event) { |
176 | if(event.detail.isDocument) { | 177 | if(event.detail.isDocument) { |
177 | if(this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() === "body") return; | 178 | // if(this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() === "body") return; |
178 | this.displayStageProperties(); | 179 | // this.displayStageProperties(); |
180 | this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); | ||
179 | } else { | 181 | } else { |
180 | if(this.application.ninja.selectedElements.length === 1) { | 182 | if(this.application.ninja.selectedElements.length === 1) { |
181 | this.displayElementProperties(this.application.ninja.selectedElements[0]); | 183 | this.displayElementProperties(this.application.ninja.selectedElements[0]); |