diff options
Diffstat (limited to 'js/stage/layout.js')
-rwxr-xr-x | js/stage/layout.js | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js index 460c8b4a..8b66150d 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js | |||
@@ -23,6 +23,28 @@ exports.Layout = Montage.create(Component, { | |||
23 | drawFillColor: { value: 'rgba(255,255,255,1)' }, | 23 | drawFillColor: { value: 'rgba(255,255,255,1)' }, |
24 | ctxLineWidth: { value: 0.2 }, | 24 | ctxLineWidth: { value: 0.2 }, |
25 | 25 | ||
26 | _currentDocument: { | ||
27 | value : null, | ||
28 | enumerable : false | ||
29 | }, | ||
30 | |||
31 | currentDocument : { | ||
32 | get : function() { | ||
33 | return this._currentDocument; | ||
34 | }, | ||
35 | set : function(value) { | ||
36 | if (value === this._currentDocument || value.getProperty("currentView") !== "design") { | ||
37 | return; | ||
38 | } | ||
39 | |||
40 | this._currentDocument = value; | ||
41 | |||
42 | if(this._currentDocument) { | ||
43 | this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes; | ||
44 | } | ||
45 | } | ||
46 | }, | ||
47 | |||
26 | _layoutView: { | 48 | _layoutView: { |
27 | value: "layoutAll" | 49 | value: "layoutAll" |
28 | }, | 50 | }, |
@@ -58,15 +80,6 @@ exports.Layout = Montage.create(Component, { | |||
58 | } | 80 | } |
59 | }, | 81 | }, |
60 | 82 | ||
61 | handleOpenDocument: { | ||
62 | value: function() { | ||
63 | // Initial elements to draw are the childrens of the root element | ||
64 | if(this.application.ninja.documentController.activeDocument.currentView === "design") { | ||
65 | this.elementsToDraw = this.application.ninja.documentController.activeDocument.model.documentRoot.childNodes; | ||
66 | } | ||
67 | } | ||
68 | }, | ||
69 | |||
70 | // Redraw stage only once after all deletion is completed | 83 | // Redraw stage only once after all deletion is completed |
71 | handleElementsRemoved: { | 84 | handleElementsRemoved: { |
72 | value: function(event) { | 85 | value: function(event) { |
@@ -79,11 +92,11 @@ exports.Layout = Montage.create(Component, { | |||
79 | value: function(event) { | 92 | value: function(event) { |
80 | var containerIndex; | 93 | var containerIndex; |
81 | 94 | ||
82 | if(this.application.ninja.documentController.activeDocument === null){ | 95 | if(this.currentDocument === null){ |
83 | return; | 96 | return; |
84 | } | 97 | } |
85 | 98 | ||
86 | if(this.application.ninja.documentController.activeDocument.currentView === "design"){ | 99 | if(this.currentDocument.currentView === "design"){ |
87 | // Make an array copy of the line node list which is not an array like object | 100 | // Make an array copy of the line node list which is not an array like object |
88 | this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true); | 101 | this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true); |
89 | // Index of the current container | 102 | // Index of the current container |
@@ -219,7 +232,7 @@ exports.Layout = Montage.create(Component, { | |||
219 | if(this.layoutView === "layoutAll") { | 232 | if(this.layoutView === "layoutAll") { |
220 | this.ctx.strokeStyle = 'rgba(0,0,0,1)'; // Black Stroke | 233 | this.ctx.strokeStyle = 'rgba(0,0,0,1)'; // Black Stroke |
221 | this.ctx.strokeRect(bounds3D[0][0]+5.5, bounds3D[0][1]-15.5, 70, 11); | 234 | this.ctx.strokeRect(bounds3D[0][0]+5.5, bounds3D[0][1]-15.5, 70, 11); |
222 | this.ctx.fillStyle = 'rgba(255,255,255,1)' // White Fill | 235 | this.ctx.fillStyle = 'rgba(255,255,255,1)'; // White Fill |
223 | this.ctx.fillRect(bounds3D[0][0]+6, bounds3D[0][1]-15, 69, 10); | 236 | this.ctx.fillRect(bounds3D[0][0]+6, bounds3D[0][1]-15, 69, 10); |
224 | 237 | ||
225 | this.ctx.fillStyle = 'rgba(0,0,0,1)'; | 238 | this.ctx.fillStyle = 'rgba(0,0,0,1)'; |