aboutsummaryrefslogtreecommitdiff
path: root/js/stage/layout.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage/layout.js')
-rwxr-xr-xjs/stage/layout.js39
1 files changed, 27 insertions, 12 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 7b6e47e7..71296405 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -23,6 +23,30 @@ 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(!value) {
43
44 } else if(this._currentDocument.currentView === "design") {
45 this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes;
46 }
47 }
48 },
49
26 _layoutView: { 50 _layoutView: {
27 value: "layoutAll" 51 value: "layoutAll"
28 }, 52 },
@@ -58,15 +82,6 @@ exports.Layout = Montage.create(Component, {
58 } 82 }
59 }, 83 },
60 84
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 85 // Redraw stage only once after all deletion is completed
71 handleElementsRemoved: { 86 handleElementsRemoved: {
72 value: function(event) { 87 value: function(event) {
@@ -79,11 +94,11 @@ exports.Layout = Montage.create(Component, {
79 value: function(event) { 94 value: function(event) {
80 var containerIndex; 95 var containerIndex;
81 96
82 if(this.application.ninja.documentController.activeDocument === null){ 97 if(this.currentDocument === null){
83 return; 98 return;
84 } 99 }
85 100
86 if(this.application.ninja.documentController.activeDocument.currentView === "design"){ 101 if(this.currentDocument.currentView === "design"){
87 // Make an array copy of the line node list which is not an array like object 102 // 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); 103 this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true);
89 // Index of the current container 104 // Index of the current container
@@ -218,7 +233,7 @@ exports.Layout = Montage.create(Component, {
218 if(this.layoutView === "layoutAll") { 233 if(this.layoutView === "layoutAll") {
219 this.ctx.strokeStyle = 'rgba(0,0,0,1)'; // Black Stroke 234 this.ctx.strokeStyle = 'rgba(0,0,0,1)'; // Black Stroke
220 this.ctx.strokeRect(bounds3D[0][0]+5.5, bounds3D[0][1]-15.5, 70, 11); 235 this.ctx.strokeRect(bounds3D[0][0]+5.5, bounds3D[0][1]-15.5, 70, 11);
221 this.ctx.fillStyle = 'rgba(255,255,255,1)' // White Fill 236 this.ctx.fillStyle = 'rgba(255,255,255,1)'; // White Fill
222 this.ctx.fillRect(bounds3D[0][0]+6, bounds3D[0][1]-15, 69, 10); 237 this.ctx.fillRect(bounds3D[0][0]+6, bounds3D[0][1]-15, 69, 10);
223 238
224 this.ctx.fillStyle = 'rgba(0,0,0,1)'; 239 this.ctx.fillStyle = 'rgba(0,0,0,1)';