aboutsummaryrefslogtreecommitdiff
path: root/js/ninja.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/ninja.reel')
-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 d97a5413..de34c7b0 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -153,10 +153,21 @@ exports.Ninja = Montage.create(Component, {
153 value: [] 153 value: []
154 }, 154 },
155 155
156 currentSelectedContainer: { 156 _currentSelectedContainer: {
157 value: null 157 value: null
158 }, 158 },
159 159
160 currentSelectedContainer: {
161 get: function() {
162 return this._currentSelectedContainer;
163 },
164 set: function(value) {
165 if(value !== this._currentSelectedContainer) {
166 this._currentSelectedContainer = value;
167 }
168 }
169 },
170
160 templateDidLoad: { 171 templateDidLoad: {
161 value: function() { 172 value: function() {
162 this.ninjaVersion = window.ninjaVersion.ninja.version; 173 this.ninjaVersion = window.ninjaVersion.ninja.version;
@@ -181,9 +192,10 @@ exports.Ninja = Montage.create(Component, {
181 192
182 window.addEventListener("resize", this, false); 193 window.addEventListener("resize", this, false);
183 194
184 this.eventManager.addEventListener( "selectTool", this, false); 195 this.eventManager.addEventListener("selectTool", this, false);
185 this.eventManager.addEventListener( "selectSubTool", this, false); 196 this.eventManager.addEventListener("selectSubTool", this, false);
186 this.eventManager.addEventListener( "onOpenDocument", this, false); 197 this.eventManager.addEventListener("onOpenDocument", this, false);
198 this.eventManager.addEventListener("onSwitchDocument", this, false);
187 199
188 this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); 200 this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false);
189 this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); 201 this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false);
@@ -288,7 +300,7 @@ exports.Ninja = Montage.create(Component, {
288 this.currentDocument = event.detail; 300 this.currentDocument = event.detail;
289 301
290 if(this.currentDocument.documentRoot) { 302 if(this.currentDocument.documentRoot) {
291 this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; 303 this.currentSelectedContainer = this.currentDocument.documentRoot;
292 } else { 304 } else {
293 alert("The current document has not loaded yet"); 305 alert("The current document has not loaded yet");
294 return; 306 return;
@@ -299,6 +311,18 @@ exports.Ninja = Montage.create(Component, {
299 } 311 }
300 }, 312 },
301 313
314 handleOnSwitchDocument: {
315 value: function() {
316 this.currentDocument = this.documentController.activeDocument;
317
318 if(this.currentDocument.documentRoot) {
319 this._currentSelectedContainer = this.selectionController._selectionContainer = this.currentDocument.documentRoot;
320 }
321
322 NJevent("switchDocument");
323 }
324 },
325
302 executeLivePreview: { 326 executeLivePreview: {
303 value: function() { 327 value: function() {
304 var background, overflow, transitionStopRule; 328 var background, overflow, transitionStopRule;