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 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'js/controllers') 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; } -- cgit v1.2.3 From f6f722feecf88c8afe59327eaf8557ce4012abc7 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 10 May 2012 22:40:02 -0700 Subject: Fixing the dirty document flag. Disabling the stylesheets dirty flag because === true on document open. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 4 ++-- js/controllers/elements/shapes-controller.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 84e9f4fc..0fd13be2 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -235,7 +235,7 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ fileSaveResult: { value: function (result) { if((result.status === 204) || (result.status === 404)){//204=>existing file || 404=>new file... saved - this.activeDocument.needsSave = false; + this.activeDocument.model.needsSave = false; if(this.application.ninja.currentDocument !== null){ //clear Dirty StyleSheets for the saved document this.application.ninja.stylesController.clearDirtyStyleSheets(this.application.ninja.currentDocument); @@ -647,7 +647,7 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ handleStyleSheetDirty:{ value:function(){ - this.activeDocument.needsSave = true; +// this.activeDocument.model.needsSave = true; } }, diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index e9a5f865..38f133b5 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -213,7 +213,7 @@ exports.ShapesController = Montage.create(CanvasController, { default: CanvasController.setProperty(el, p, value); } - this.application.ninja.documentController.activeDocument.needsSave = true; + this.application.ninja.documentController.activeDocument.model.needsSave = true; } }, @@ -559,7 +559,7 @@ exports.ShapesController = Montage.create(CanvasController, { } } el.elementModel.shapeModel.GLWorld.render(); - this.application.ninja.documentController.activeDocument.needsSave = true; + this.application.ninja.documentController.activeDocument.model.needsSave = true; } }, -- cgit v1.2.3