diff options
author | Jose Antonio Marquez | 2012-05-24 00:07:23 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-05-24 00:07:23 -0700 |
commit | 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 (patch) | |
tree | f0910e57f64d1638f00bf7f6449d479fb377bfac /js/panels | |
parent | 16decc5726eafbb25675c61be6df85a378ac1fac (diff) | |
download | ninja-5914c5b2209c4b8daac4249bb76cda5c9314c4e6.tar.gz |
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.
Diffstat (limited to 'js/panels')
9 files changed, 21 insertions, 21 deletions
diff --git a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js index 4c0a3611..b4a803b2 100755 --- a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js +++ b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js | |||
@@ -87,7 +87,7 @@ var CSSPanel = exports.CSSPanelBase = (require("montage/core/core").Montage).cre | |||
87 | 87 | ||
88 | populateStyleSheetList: { | 88 | populateStyleSheetList: { |
89 | value: function() { | 89 | value: function() { |
90 | this.sections.sheets.doc = this.application.ninja.currentDocument._document; | 90 | this.sections.sheets.doc = this.application.ninja.currentDocument.model.views.design.document; |
91 | var styleTagCount = 0, | 91 | var styleTagCount = 0, |
92 | sect = this.sections.sheets, | 92 | sect = this.sections.sheets, |
93 | sheetsArray = nj.toArray(sect.doc.styleSheets), | 93 | sheetsArray = nj.toArray(sect.doc.styleSheets), |
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index c382c9a7..d61075ac 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -597,11 +597,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
597 | // But what if we're opening an existing document? | 597 | // But what if we're opening an existing document? |
598 | if (!this.application.ninja.documentController.creatingNewFile) { | 598 | if (!this.application.ninja.documentController.creatingNewFile) { |
599 | // Opening an existing document. If it has DOM elements we need to restore their timeline info | 599 | // Opening an existing document. If it has DOM elements we need to restore their timeline info |
600 | if (this.application.ninja.currentDocument.documentRoot.children[0]) { | 600 | if (this.application.ninja.currentDocument.model.documentRoot.children[0]) { |
601 | // Yes, it has DOM elements. Loop through them and create a new object for each. | 601 | // Yes, it has DOM elements. Loop through them and create a new object for each. |
602 | for (myIndex = 0; this.application.ninja.currentDocument.documentRoot.children[myIndex]; myIndex++) { | 602 | for (myIndex = 0; this.application.ninja.currentDocument.model.documentRoot.children[myIndex]; myIndex++) { |
603 | this._openDoc = true; | 603 | this._openDoc = true; |
604 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); | 604 | this.restoreLayer(this.application.ninja.currentDocument.model.documentRoot.children[myIndex]); |
605 | } | 605 | } |
606 | } | 606 | } |
607 | } | 607 | } |
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 2c15a99c..adc50c58 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -438,7 +438,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
438 | didDraw:{ | 438 | didDraw:{ |
439 | value:function () { | 439 | value:function () { |
440 | if ((!this.application.ninja.documentController.creatingNewFile)||(!this.application.ninja.currentDocument.setLevel)) { | 440 | if ((!this.application.ninja.documentController.creatingNewFile)||(!this.application.ninja.currentDocument.setLevel)) { |
441 | if (this.application.ninja.currentDocument.documentRoot.children[0]) { | 441 | if (this.application.ninja.currentDocument.model.documentRoot.children[0]) { |
442 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 442 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
443 | if (selectedIndex !== false) { | 443 | if (selectedIndex !== false) { |
444 | if (!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created) { | 444 | if (!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created) { |
@@ -592,7 +592,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
592 | trackTiming = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); | 592 | trackTiming = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); |
593 | this.nextKeyframe = 0; | 593 | this.nextKeyframe = 0; |
594 | 594 | ||
595 | this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); | 595 | this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument.model.views.design.document); |
596 | 596 | ||
597 | for (i =0; this.currentKeyframeRule[i] ;i++) { | 597 | for (i =0; this.currentKeyframeRule[i] ;i++) { |
598 | var newTween = {}; | 598 | var newTween = {}; |
diff --git a/js/panels/components-panel.reel/components-panel.js b/js/panels/components-panel.reel/components-panel.js index e028d1db..3ad1763d 100755 --- a/js/panels/components-panel.reel/components-panel.js +++ b/js/panels/components-panel.reel/components-panel.js | |||
@@ -398,8 +398,8 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
398 | //if(!this.centerStage) { | 398 | //if(!this.centerStage) { |
399 | var top, left; | 399 | var top, left; |
400 | 400 | ||
401 | top = (this.application.ninja.stage.canvas.height / 2); // ~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.documentRoot, "height"))) / 2); | 401 | top = (this.application.ninja.stage.canvas.height / 2); // ~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.model.documentRoot, "height"))) / 2); |
402 | left = (this.application.ninja.stage.canvas.width / 2); //~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.documentRoot, "width"))) / 2); | 402 | left = (this.application.ninja.stage.canvas.width / 2); //~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.model.documentRoot, "width"))) / 2); |
403 | //this.centerStage = [top, left]; | 403 | //this.centerStage = [top, left]; |
404 | return [left, top]; | 404 | return [left, top]; |
405 | //} | 405 | //} |
diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js index 5229b92e..454008fa 100644 --- a/js/panels/css-panel/styles-view-delegate.js +++ b/js/panels/css-panel/styles-view-delegate.js | |||
@@ -30,7 +30,7 @@ exports.StylesViewDelegate = Montage.create(Component, { | |||
30 | value: function(selector, direction) { | 30 | value: function(selector, direction) { |
31 | if(!selector) { return false; } | 31 | if(!selector) { return false; } |
32 | 32 | ||
33 | var elements = this.stylesController._activeDocument._document.querySelectorAll(selector), | 33 | var elements = this.stylesController._activeDocument.model.views.design.document.querySelectorAll(selector), |
34 | method = (direction === "out") ? "remove" : "add"; | 34 | method = (direction === "out") ? "remove" : "add"; |
35 | 35 | ||
36 | Array.prototype.slice.call(elements).forEach(function(el) { | 36 | Array.prototype.slice.call(elements).forEach(function(el) { |
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, { | |||
73 | this.application.ninja.currentDocument.model.views.design.propertiesPanel = this; | 73 | this.application.ninja.currentDocument.model.views.design.propertiesPanel = this; |
74 | 74 | ||
75 | // Display the default document root PI | 75 | // Display the default document root PI |
76 | this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); | 76 | this.displayElementProperties(this.application.ninja.currentDocument.model.documentRoot); |
77 | } | 77 | } |
78 | }, | 78 | }, |
79 | 79 | ||
@@ -95,7 +95,7 @@ exports.Properties = Montage.create(Component, { | |||
95 | this.elementId.value = this.elementId.value.replace(/\s/g, ''); | 95 | this.elementId.value = this.elementId.value.replace(/\s/g, ''); |
96 | 96 | ||
97 | // Check if that id is in use | 97 | // Check if that id is in use |
98 | if(this.application.ninja.currentDocument._document.getElementById(this.elementId.value) !== null) { | 98 | if(this.application.ninja.currentDocument.model.views.design.document.getElementById(this.elementId.value) !== null) { |
99 | // TODO: Replace with Ninja Alert | 99 | // TODO: Replace with Ninja Alert |
100 | alert("The following ID: " + this.elementId.value + " is already in use"); | 100 | alert("The following ID: " + this.elementId.value + " is already in use"); |
101 | } | 101 | } |
@@ -104,13 +104,13 @@ exports.Properties = Montage.create(Component, { | |||
104 | // ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi"); | 104 | // ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi"); |
105 | ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, this.application.ninja.selectedElements[0].id, "pi"); | 105 | ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, this.application.ninja.selectedElements[0].id, "pi"); |
106 | } else { | 106 | } else { |
107 | ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id); | 107 | ElementsMediator.setAttribute(this.application.ninja.currentDocument.model.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.model.documentRoot.elementModel.id); |
108 | } | 108 | } |
109 | } else if(event.target.id === "elementClass") { | 109 | } else if(event.target.id === "elementClass") { |
110 | if(this.application.ninja.selectedElements.length) { | 110 | if(this.application.ninja.selectedElements.length) { |
111 | ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "class", this.elementClass.value, this.application.ninja.selectedElements[0].className, "pi"); | 111 | ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "class", this.elementClass.value, this.application.ninja.selectedElements[0].className, "pi"); |
112 | } else { | 112 | } else { |
113 | ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "class", this.elementClass.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.elementClass); | 113 | ElementsMediator.setAttribute(this.application.ninja.currentDocument.model.documentRoot, "class", this.elementClass.value, "Change", "pi", this.application.ninja.currentDocument.model.documentRoot.elementModel.elementClass); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | } | 116 | } |
@@ -135,7 +135,7 @@ exports.Properties = Montage.create(Component, { | |||
135 | value: function(event) { | 135 | value: function(event) { |
136 | // console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update | 136 | // console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update |
137 | if(event.detail.source && event.detail.source !== "pi") { | 137 | if(event.detail.source && event.detail.source !== "pi") { |
138 | var el = this.application.ninja.currentDocument.documentRoot; | 138 | var el = this.application.ninja.currentDocument.model.documentRoot; |
139 | if(this.application.ninja.selectedElements.length) { | 139 | if(this.application.ninja.selectedElements.length) { |
140 | el = this.application.ninja.selectedElements[0]; | 140 | el = this.application.ninja.selectedElements[0]; |
141 | } | 141 | } |
@@ -161,7 +161,7 @@ exports.Properties = Montage.create(Component, { | |||
161 | handleSelectionChange: { | 161 | handleSelectionChange: { |
162 | value: function(event) { | 162 | value: function(event) { |
163 | if(event.detail.isDocument) { | 163 | if(event.detail.isDocument) { |
164 | this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); | 164 | this.displayElementProperties(this.application.ninja.currentDocument.model.documentRoot); |
165 | } else { | 165 | } else { |
166 | if(this.application.ninja.selectedElements.length === 1) { | 166 | if(this.application.ninja.selectedElements.length === 1) { |
167 | this.displayElementProperties(this.application.ninja.selectedElements[0]); | 167 | 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, { | |||
116 | value: function(event) { | 116 | value: function(event) { |
117 | // Change the stage color for now | 117 | // Change the stage color for now |
118 | //console.log(this, event); | 118 | //console.log(this, event); |
119 | ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); | 119 | ElementsMediator.setProperty([this.application.ninja.currentDocument.model.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); |
120 | /* | 120 | /* |
121 | var propEvent = document.createEvent("CustomEvent"); | 121 | var propEvent = document.createEvent("CustomEvent"); |
122 | propEvent.initEvent("propertyChange", true, true); | 122 | 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, { | |||
158 | if(!event.wasSetByCode) { | 158 | if(!event.wasSetByCode) { |
159 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; | 159 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; |
160 | 160 |