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.js71
1 files changed, 46 insertions, 25 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index d0eb1557..4c1efff4 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 },
@@ -129,7 +151,6 @@ exports.Ninja = Montage.create(Component, {
129 } 151 }
130 }, 152 },
131 153
132
133 selectedElements: { 154 selectedElements: {
134 value: [] 155 value: []
135 }, 156 },
@@ -174,8 +195,6 @@ exports.Ninja = Montage.create(Component, {
174 195
175 this.eventManager.addEventListener("selectTool", this, false); 196 this.eventManager.addEventListener("selectTool", this, false);
176 this.eventManager.addEventListener("selectSubTool", this, false); 197 this.eventManager.addEventListener("selectSubTool", this, false);
177 this.eventManager.addEventListener("onOpenDocument", this, false);
178 this.eventManager.addEventListener("onSwitchDocument", this, false);
179 198
180 this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); 199 this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false);
181 this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); 200 this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false);
@@ -190,7 +209,7 @@ exports.Ninja = Montage.create(Component, {
190 //TODO: Expand method to allow other browsers for preview 209 //TODO: Expand method to allow other browsers for preview
191 executeChromePreview: { 210 executeChromePreview: {
192 value: function () { 211 value: function () {
193 this.application.ninja.documentController.activeDocument.model.browserPreview('chrome'); 212 this.currentDocument.model.browserPreview('chrome');
194 } 213 }
195 }, 214 },
196 //////////////////////////////////////////////////////////////////// 215 ////////////////////////////////////////////////////////////////////
@@ -275,31 +294,33 @@ exports.Ninja = Montage.create(Component, {
275 } 294 }
276 }, 295 },
277 296
278 handleOnOpenDocument: { 297 openDocument: {
279 value: function(event) { 298 value: function(doc) {
280 this.currentDocument = event.detail;
281 299
282 if(this.currentDocument.model.documentRoot) { 300
283 this.currentSelectedContainer = this.currentDocument.model.documentRoot; 301
284 } else { 302 this.documentList.content.push(doc);
285 alert("The current document has not loaded yet"); 303 // This is not needed with the latest 0.10 montage.
286 return; 304 // TODO: Remove this when integrating the next montage
305 this.documentList.selectedObjects = [doc];
306
307 if(doc.currentView === "design") {
308 // TODO: Bind directly to the model of the document in components instead of this property
309 this.currentSelectedContainer = doc.model.documentRoot;
287 } 310 }
288 311
289 this.appModel.show3dGrid = this.currentDocument.draw3DGrid; 312
290 NJevent("openDocument"); 313// this.appModel.show3dGrid = this.currentDocument.draw3DGrid;
314
315
291 } 316 }
292 }, 317 },
293 318
294 handleOnSwitchDocument: { 319 closeFile: {
295 value: function() { 320 value: function(document) {
296 this.currentDocument = this.documentController.activeDocument; 321 var doc = this.documentList.content[this.documentList.content.indexOf(document)];
297
298 if(this.currentDocument.model.documentRoot) {
299 this._currentSelectedContainer = this.selectionController._selectionContainer = this.currentDocument.model.documentRoot;
300 }
301 322
302 NJevent("switchDocument"); 323 this.documentList.removeObjects(doc);
303 } 324 }
304 }, 325 },
305 326