diff options
Diffstat (limited to 'js/ninja.reel/ninja.js')
-rwxr-xr-x | js/ninja.reel/ninja.js | 71 |
1 files changed, 55 insertions, 16 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index d0eb1557..987c32fd 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -18,12 +18,33 @@ exports.Ninja = Montage.create(Component, { | |||
18 | value: null | 18 | value: null |
19 | }, | 19 | }, |
20 | 20 | ||
21 | toolsData: { value: null }, | 21 | toolsData: { |
22 | appData: { value: AppData }, | 22 | value: null |
23 | }, | ||
24 | |||
25 | appData: { | ||
26 | value: AppData | ||
27 | }, | ||
23 | 28 | ||
29 | /* | ||
24 | currentDocument: { | 30 | currentDocument: { |
25 | value: null | 31 | value: null |
26 | }, | 32 | }, |
33 | */ | ||
34 | |||
35 | documentList: { | ||
36 | value: null | ||
37 | }, | ||
38 | |||
39 | currentDocument: { | ||
40 | get: function() { | ||
41 | if(this.documentList.selectedObjects) { | ||
42 | return this.documentList.selectedObjects[0]; | ||
43 | } else { | ||
44 | return null; | ||
45 | } | ||
46 | } | ||
47 | }, | ||
27 | 48 | ||
28 | _isResizing: { | 49 | _isResizing: { |
29 | value: null | 50 | value: null |
@@ -55,9 +76,10 @@ exports.Ninja = Montage.create(Component, { | |||
55 | } | 76 | } |
56 | }, | 77 | }, |
57 | 78 | ||
58 | _resizedWidth : { | 79 | _resizedWidth: { |
59 | value: 0 | 80 | value: 0 |
60 | }, | 81 | }, |
82 | |||
61 | _width: { | 83 | _width: { |
62 | value: null | 84 | value: null |
63 | }, | 85 | }, |
@@ -174,7 +196,6 @@ exports.Ninja = Montage.create(Component, { | |||
174 | 196 | ||
175 | this.eventManager.addEventListener("selectTool", this, false); | 197 | this.eventManager.addEventListener("selectTool", this, false); |
176 | this.eventManager.addEventListener("selectSubTool", this, false); | 198 | this.eventManager.addEventListener("selectSubTool", this, false); |
177 | this.eventManager.addEventListener("onOpenDocument", this, false); | ||
178 | this.eventManager.addEventListener("onSwitchDocument", this, false); | 199 | this.eventManager.addEventListener("onSwitchDocument", this, false); |
179 | 200 | ||
180 | this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); | 201 | this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); |
@@ -190,7 +211,7 @@ exports.Ninja = Montage.create(Component, { | |||
190 | //TODO: Expand method to allow other browsers for preview | 211 | //TODO: Expand method to allow other browsers for preview |
191 | executeChromePreview: { | 212 | executeChromePreview: { |
192 | value: function () { | 213 | value: function () { |
193 | this.application.ninja.documentController.activeDocument.model.browserPreview('chrome'); | 214 | this.currentDocument.model.browserPreview('chrome'); |
194 | } | 215 | } |
195 | }, | 216 | }, |
196 | //////////////////////////////////////////////////////////////////// | 217 | //////////////////////////////////////////////////////////////////// |
@@ -275,19 +296,37 @@ exports.Ninja = Montage.create(Component, { | |||
275 | } | 296 | } |
276 | }, | 297 | }, |
277 | 298 | ||
278 | handleOnOpenDocument: { | 299 | openDocument: { |
279 | value: function(event) { | 300 | value: function(doc) { |
280 | this.currentDocument = event.detail; | ||
281 | 301 | ||
282 | if(this.currentDocument.model.documentRoot) { | ||
283 | this.currentSelectedContainer = this.currentDocument.model.documentRoot; | ||
284 | } else { | ||
285 | alert("The current document has not loaded yet"); | ||
286 | return; | ||
287 | } | ||
288 | 302 | ||
289 | this.appModel.show3dGrid = this.currentDocument.draw3DGrid; | 303 | |
290 | NJevent("openDocument"); | 304 | this.documentList.content.push(doc); |
305 | // This is not needed with the latest 0.10 montage. | ||
306 | // TODO: Remove this when integrating the next montage | ||
307 | this.documentList.selectedObjects = [doc]; | ||
308 | |||
309 | // TODO: Bind directly to the model of the document in components instead of this property | ||
310 | this.currentSelectedContainer = doc.model.documentRoot; | ||
311 | |||
312 | // if(this.currentDocument.model.documentRoot) { | ||
313 | // this.currentSelectedContainer = this.currentDocument.model.documentRoot; | ||
314 | // } else { | ||
315 | // alert("The current document has not loaded yet"); | ||
316 | // return; | ||
317 | // } | ||
318 | |||
319 | // this.appModel.show3dGrid = this.currentDocument.draw3DGrid; | ||
320 | // NJevent("openDocument"); | ||
321 | |||
322 | } | ||
323 | }, | ||
324 | |||
325 | closeFile: { | ||
326 | value: function(document) { | ||
327 | var doc = this.documentList.content[this.documentList.content.indexOf(document)]; | ||
328 | |||
329 | this.documentList.removeObjects(doc); | ||
291 | } | 330 | } |
292 | }, | 331 | }, |
293 | 332 | ||