aboutsummaryrefslogtreecommitdiff
path: root/js/ninja.reel/ninja.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/ninja.reel/ninja.js')
-rwxr-xr-xjs/ninja.reel/ninja.js34
1 files changed, 29 insertions, 5 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index 9f0456ae..80d1b406 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -134,10 +134,21 @@ exports.Ninja = Montage.create(Component, {
134 value: [] 134 value: []
135 }, 135 },
136 136
137 currentSelectedContainer: { 137 _currentSelectedContainer: {
138 value: null 138 value: null
139 }, 139 },
140 140
141 currentSelectedContainer: {
142 get: function() {
143 return this._currentSelectedContainer;
144 },
145 set: function(value) {
146 if(value !== this._currentSelectedContainer) {
147 this._currentSelectedContainer = value;
148 }
149 }
150 },
151
141 templateDidLoad: { 152 templateDidLoad: {
142 value: function() { 153 value: function() {
143 this.ninjaVersion = window.ninjaVersion.ninja.version; 154 this.ninjaVersion = window.ninjaVersion.ninja.version;
@@ -161,9 +172,10 @@ exports.Ninja = Montage.create(Component, {
161 172
162 window.addEventListener("resize", this, false); 173 window.addEventListener("resize", this, false);
163 174
164 this.eventManager.addEventListener( "selectTool", this, false); 175 this.eventManager.addEventListener("selectTool", this, false);
165 this.eventManager.addEventListener( "selectSubTool", this, false); 176 this.eventManager.addEventListener("selectSubTool", this, false);
166 this.eventManager.addEventListener( "onOpenDocument", this, false); 177 this.eventManager.addEventListener("onOpenDocument", this, false);
178 this.eventManager.addEventListener("onSwitchDocument", this, false);
167 179
168 this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); 180 this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false);
169 this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); 181 this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false);
@@ -268,7 +280,7 @@ exports.Ninja = Montage.create(Component, {
268 this.currentDocument = event.detail; 280 this.currentDocument = event.detail;
269 281
270 if(this.currentDocument.documentRoot) { 282 if(this.currentDocument.documentRoot) {
271 this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; 283 this.currentSelectedContainer = this.currentDocument.documentRoot;
272 } else { 284 } else {
273 alert("The current document has not loaded yet"); 285 alert("The current document has not loaded yet");
274 return; 286 return;
@@ -279,6 +291,18 @@ exports.Ninja = Montage.create(Component, {
279 } 291 }
280 }, 292 },
281 293
294 handleOnSwitchDocument: {
295 value: function() {
296 this.currentDocument = this.documentController.activeDocument;
297
298 if(this.currentDocument.documentRoot) {
299 this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot;
300 }
301
302 NJevent("switchDocument");
303 }
304 },
305
282 executeLivePreview: { 306 executeLivePreview: {
283 value: function() { 307 value: function() {
284 var background, overflow, transitionStopRule; 308 var background, overflow, transitionStopRule;