From e7293b28c53b23e64044c29e8451cbf3fc0bd049 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 10 May 2012 22:25:26 -0700 Subject: Partially fixing the body pi and fixing the selection controller Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 17 ++++++----------- js/panels/properties.reel/properties.js | 6 ++++-- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'js') 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, { while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { // If element is higher up than current container then return - if(outerElement.id === "UserContent") return; + if(outerElement.nodeName === "BODY") return; // else keep going up the chain outerElement = outerElement.parentNode; } @@ -246,25 +246,20 @@ exports.SelectionController = Montage.create(Component, { } }, - /** - * Looks into the selectionObject for the item to be found using it's id - * - * @return: Item index in the selectionObject if found - * -1 if not found - */ findSelectedElement: { value: function(item) { - // TODO do the loop check in the select element and only use the index here - // return this.application.ninja.selectedElements.indexOf(item); + // TODO: Remove this function and use the stage selectable. Then only return a match in the array + //return this.application.ninja.selectedElements.indexOf(item); + //TODO: Make sure we don't need to loop back to the container element. var itemUUID; for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { // Check for multiple selection and excluding inner elements - if(item.parentNode && item.parentNode.id !== "UserContent") { + if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.documentRoot) { var outerElement = item.parentNode; - while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { + while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.documentRoot) { outerElement = outerElement.parentNode; } 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, { if(this.application.ninja.selectedElements.length === 0 && this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() !== "body") { this.displayStageProperties(); } + this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); } }, @@ -174,8 +175,9 @@ exports.Properties = Montage.create(Component, { handleSelectionChange: { value: function(event) { if(event.detail.isDocument) { - if(this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() === "body") return; - this.displayStageProperties(); +// if(this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() === "body") return; +// this.displayStageProperties(); + this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); } else { if(this.application.ninja.selectedElements.length === 1) { this.displayElementProperties(this.application.ninja.selectedElements[0]); -- cgit v1.2.3