From 2154ace6bdc2abe55fae353849d3beb64b8ada25 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 24 May 2012 16:14:40 -0700 Subject: Don't loop through layout drawing code if layout view is off. Signed-off-by: Nivesh Rajbhandari --- js/stage/layout.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'js/stage/layout.js') diff --git a/js/stage/layout.js b/js/stage/layout.js index 460c8b4a..7b4ccc17 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -121,6 +121,10 @@ exports.Layout = Montage.create(Component, { value: function() { this.clearCanvas(); + // TODO Bind the layoutview mode to the current document + // var mode = this.application.ninja.currentDocument.layoutMode; + if(this.layoutView === "layoutOff") return; + var els = this.elementsToDraw.length; for(var i = 0, el; i < els; i++){ this.drawTagOutline(this.elementsToDraw[i]); @@ -154,11 +158,6 @@ exports.Layout = Montage.create(Component, { if(!item || !this.application.ninja.selectionController.isNodeTraversable(item)) return; - // TODO Bind the layoutview mode to the current document - // var mode = this.application.ninja.currentDocument.layoutMode; - - if(this.layoutView === "layoutOff") return; - // Don't draw outlines for shapes. // TODO Use the element mediator/controller/model to see if its a shape // if (utilsModule.utils.isElementAShape(item)) return; -- cgit v1.2.3 From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- js/stage/layout.js | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'js/stage/layout.js') 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, { drawFillColor: { value: 'rgba(255,255,255,1)' }, ctxLineWidth: { value: 0.2 }, + _currentDocument: { + value : null, + enumerable : false + }, + + currentDocument : { + get : function() { + return this._currentDocument; + }, + set : function(value) { + if (value === this._currentDocument || value.getProperty("currentView") !== "design") { + return; + } + + this._currentDocument = value; + + if(this._currentDocument) { + this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes; + } + } + }, + _layoutView: { value: "layoutAll" }, @@ -58,15 +80,6 @@ exports.Layout = Montage.create(Component, { } }, - handleOpenDocument: { - value: function() { - // Initial elements to draw are the childrens of the root element - if(this.application.ninja.documentController.activeDocument.currentView === "design") { - this.elementsToDraw = this.application.ninja.documentController.activeDocument.model.documentRoot.childNodes; - } - } - }, - // Redraw stage only once after all deletion is completed handleElementsRemoved: { value: function(event) { @@ -79,11 +92,11 @@ exports.Layout = Montage.create(Component, { value: function(event) { var containerIndex; - if(this.application.ninja.documentController.activeDocument === null){ + if(this.currentDocument === null){ return; } - if(this.application.ninja.documentController.activeDocument.currentView === "design"){ + if(this.currentDocument.currentView === "design"){ // Make an array copy of the line node list which is not an array like object this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true); // Index of the current container @@ -219,7 +232,7 @@ exports.Layout = Montage.create(Component, { if(this.layoutView === "layoutAll") { this.ctx.strokeStyle = 'rgba(0,0,0,1)'; // Black Stroke this.ctx.strokeRect(bounds3D[0][0]+5.5, bounds3D[0][1]-15.5, 70, 11); - this.ctx.fillStyle = 'rgba(255,255,255,1)' // White Fill + this.ctx.fillStyle = 'rgba(255,255,255,1)'; // White Fill this.ctx.fillRect(bounds3D[0][0]+6, bounds3D[0][1]-15, 69, 10); this.ctx.fillStyle = 'rgba(0,0,0,1)'; -- cgit v1.2.3 From 961830a1ab076db70577df735f43cae5e8559e83 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 29 May 2012 14:55:19 -0700 Subject: Moving layout and stageDeps' handleOpenDocument into stage. Signed-off-by: Nivesh Rajbhandari --- js/stage/layout.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'js/stage/layout.js') diff --git a/js/stage/layout.js b/js/stage/layout.js index 7b4ccc17..4eecd4d5 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -140,9 +140,8 @@ exports.Layout = Montage.create(Component, { if(this.stage.appModel.show3dGrid) { this.application.ninja.stage.stageDeps.snapManager.updateWorkingPlaneFromView(); - drawUtils.drawWorkingPlane(); } - + drawUtils.drawWorkingPlane(); drawUtils.draw3DCompass(); } }, -- cgit v1.2.3 From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/stage/layout.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/stage/layout.js') diff --git a/js/stage/layout.js b/js/stage/layout.js index 8b66150d..284968e4 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -33,13 +33,15 @@ exports.Layout = Montage.create(Component, { return this._currentDocument; }, set : function(value) { - if (value === this._currentDocument || value.getProperty("currentView") !== "design") { + if (value === this._currentDocument) {// || value.getProperty("currentView") !== "design") { return; } this._currentDocument = value; - if(this._currentDocument) { + if(!value) { + + } else if(this._currentDocument.currentView === "design") { this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes; } } -- cgit v1.2.3 From d4f2df2a7b3ec79fc54e17f09195dbc37331f051 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 30 May 2012 09:55:33 -0700 Subject: Fix for snap-align not working correctly after resizing the stage. Signed-off-by: Nivesh Rajbhandari --- js/stage/layout.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/stage/layout.js') diff --git a/js/stage/layout.js b/js/stage/layout.js index 4eecd4d5..7b6e47e7 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -136,6 +136,7 @@ exports.Layout = Montage.create(Component, { value: function(updatePlanes) { if(updatePlanes) { drawUtils.updatePlanes(); + this.application.ninja.stage.stageDeps.snapManager._isCacheInvalid = true; } if(this.stage.appModel.show3dGrid) { -- cgit v1.2.3