From f97590388467b5a3316f6f155162fc293915fddc Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 23 May 2012 16:09:22 -0700 Subject: Fixed scrolling and centering stage code. Also, moved liveNodeList into the design view and added an option to exclude styles and text nodes when retrieving the live nodes. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'js/helper-classes/3D/draw-utils.js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index bf48a723..79be5c14 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -119,7 +119,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { initializeFromDocument:{ value:function(){ - var documentRootChildren = null, i, stage = this.application.ninja.stage; + var i, + documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), + stage = this.application.ninja.stage, + len = documentRootChildren.length; //initialize with current document this._eltArray = []; this._planesArray = []; @@ -128,11 +131,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them - if(this.application.ninja.currentDocument._liveNodeList.length > 0){ - documentRootChildren = this.application.ninja.currentDocument._liveNodeList; - var len = documentRootChildren.length, - minLeft = stage.userPaddingLeft, - minTop = stage.userPaddingTop, + if(len > 0) { + var initL = 0, + initT = 0, + minLeft = 0, + minTop = 0, docLeft = stage.documentOffsetLeft, docTop = stage.documentOffsetTop, l, @@ -151,10 +154,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { minTop = t; } } - if(minLeft !== stage.userPaddingLeft) { + if(minLeft !== initL) { stage.userPaddingLeft = minLeft; } - if(minTop !== stage.userPaddingTop) { + if(minTop !== initT) { stage.userPaddingTop = minTop; } } -- cgit v1.2.3 From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: Cleaning up referencing to 'documentRoot' and '_document' Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view. --- js/helper-classes/3D/draw-utils.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js/helper-classes/3D/draw-utils.js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index bf48a723..9de85216 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -124,7 +124,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._eltArray = []; this._planesArray = []; this.setDrawingSurfaceElement(stage.canvas); - this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); + this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them @@ -697,7 +697,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._lineColor = saveColor; this._drawingContext.lineWidth = saveLineWidth; - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { // draw an outline around the body var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); @@ -815,7 +815,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // draw the lines var line, nLines = this._gridLineArray.length; - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { nLines = this._gridLineArray.length-4; } @@ -824,7 +824,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.drawIntersectedLine(line, this._drawingContext); } - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { this._lineColor = "red"; i = nLines; nLines += 4; @@ -923,7 +923,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // if all of the planes are aligned, check if they are aligned with the view direction if (flat) { - var stage = this.application.ninja.currentDocument.documentRoot; + var stage = this.application.ninja.currentDocument.model.documentRoot; var stageMat = this.viewUtils.getMatrixFromElement(stage); var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; viewDir = vecUtils.vecNormalize( 3, viewDir ); @@ -1213,7 +1213,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { value: function() { // set the element to be the viewport object - temporarily var tmpCanvas = this.application.ninja.stage.canvas; - var tmpStage = this.application.ninja.currentDocument.documentRoot; + var tmpStage = this.application.ninja.currentDocument.model.documentRoot; this.viewUtils.pushViewportObj( tmpCanvas ); // save the source space object and set to the target object -- cgit v1.2.3