From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: Cleaning up referencing to 'documentRoot' and '_document' Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view. --- js/panels/properties.reel/properties.js | 12 ++++++------ js/panels/properties.reel/sections/custom.reel/custom.js | 2 +- .../sections/position-size.reel/position-size.js | 8 ++++---- .../sections/three-d-view.reel/three-d-view.js | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'js/panels/properties.reel') diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index b292a66a..e3ecce10 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -73,7 +73,7 @@ exports.Properties = Montage.create(Component, { this.application.ninja.currentDocument.model.views.design.propertiesPanel = this; // Display the default document root PI - this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); + this.displayElementProperties(this.application.ninja.currentDocument.model.documentRoot); } }, @@ -95,7 +95,7 @@ exports.Properties = Montage.create(Component, { this.elementId.value = this.elementId.value.replace(/\s/g, ''); // Check if that id is in use - if(this.application.ninja.currentDocument._document.getElementById(this.elementId.value) !== null) { + if(this.application.ninja.currentDocument.model.views.design.document.getElementById(this.elementId.value) !== null) { // TODO: Replace with Ninja Alert alert("The following ID: " + this.elementId.value + " is already in use"); } @@ -104,13 +104,13 @@ exports.Properties = Montage.create(Component, { // ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi"); ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, this.application.ninja.selectedElements[0].id, "pi"); } else { - ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id); + ElementsMediator.setAttribute(this.application.ninja.currentDocument.model.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.model.documentRoot.elementModel.id); } } else if(event.target.id === "elementClass") { if(this.application.ninja.selectedElements.length) { ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "class", this.elementClass.value, this.application.ninja.selectedElements[0].className, "pi"); } else { - ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "class", this.elementClass.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.elementClass); + ElementsMediator.setAttribute(this.application.ninja.currentDocument.model.documentRoot, "class", this.elementClass.value, "Change", "pi", this.application.ninja.currentDocument.model.documentRoot.elementModel.elementClass); } } } @@ -135,7 +135,7 @@ exports.Properties = Montage.create(Component, { value: function(event) { // console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update if(event.detail.source && event.detail.source !== "pi") { - var el = this.application.ninja.currentDocument.documentRoot; + var el = this.application.ninja.currentDocument.model.documentRoot; if(this.application.ninja.selectedElements.length) { el = this.application.ninja.selectedElements[0]; } @@ -161,7 +161,7 @@ exports.Properties = Montage.create(Component, { handleSelectionChange: { value: function(event) { if(event.detail.isDocument) { - this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); + this.displayElementProperties(this.application.ninja.currentDocument.model.documentRoot); } else { if(this.application.ninja.selectedElements.length === 1) { this.displayElementProperties(this.application.ninja.selectedElements[0]); diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js index b1fd910d..ae408f11 100755 --- a/js/panels/properties.reel/sections/custom.reel/custom.js +++ b/js/panels/properties.reel/sections/custom.reel/custom.js @@ -116,7 +116,7 @@ exports.CustomSection = Montage.create(Component, { value: function(event) { // Change the stage color for now //console.log(this, event); - ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); + ElementsMediator.setProperty([this.application.ninja.currentDocument.model.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); /* var propEvent = document.createEvent("CustomEvent"); propEvent.initEvent("propertyChange", true, true); diff --git a/js/panels/properties.reel/sections/position-size.reel/position-size.js b/js/panels/properties.reel/sections/position-size.reel/position-size.js index 10e084be..7c24e02a 100755 --- a/js/panels/properties.reel/sections/position-size.reel/position-size.js +++ b/js/panels/properties.reel/sections/position-size.reel/position-size.js @@ -158,7 +158,7 @@ exports.PositionSize = Montage.create(Component, { if(!event.wasSetByCode) { if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; + this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; if(this.bindButton.pressed) { @@ -183,7 +183,7 @@ exports.PositionSize = Montage.create(Component, { if(!event.wasSetByCode) { if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; + this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; if(this.bindButton.pressed) { @@ -231,7 +231,7 @@ exports.PositionSize = Montage.create(Component, { if(!this.savedPosition) this.savedPosition = this.heightSize; - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; + this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; if(this.bindButton.pressed) { @@ -256,7 +256,7 @@ exports.PositionSize = Montage.create(Component, { if(!this.savedPosition) this.savedPosition = this.widthSize; - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; + this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; if(this.bindButton.pressed) { var newHeight = Math.round(this.aspectRatioWidth * this.widthControl.value); diff --git a/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js b/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js index dcba51a4..e16e3509 100755 --- a/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js +++ b/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js @@ -247,7 +247,7 @@ exports.ThreeD = Montage.create(Component, { if(els.length) { return els[0]; } else { - return this.boundObject.application.ninja.currentDocument.documentRoot; + return this.boundObject.application.ninja.currentDocument.model.documentRoot; } } }, -- cgit v1.2.3