From 8f8f7f9a36fb9abadea2a9f25aef0084946bebc9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 4 May 2012 14:42:00 -0700 Subject: Removed special-casing for new template workflow. Instead, we will enforce a width and height on the body in order to do 3d. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 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 88830964..f869f65e 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -584,18 +584,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane); // define the grid parameters - var width, - height, + var width = this.snapManager.getStageWidth(), + height = this.snapManager.getStageHeight(), nLines = 10; -// if(this.application.ninja.documentController.webTemplate) { - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { - width = this.application.ninja.currentDocument.documentRoot.scrollWidth; - height = this.application.ninja.currentDocument.documentRoot.scrollHeight; - } else { - width = this.snapManager.getStageWidth(); - height = this.snapManager.getStageHeight(); - } // get a matrix from working plane space to the world var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane); var tMat = Matrix.Translation( [0.5*width, 0.5*height, 0] ); -- cgit v1.2.3 From fb71f5715a288b59d6b151c11a293e179d2c9ace Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 10 May 2012 10:04:26 -0700 Subject: Draw 3d compass at the bottom-left. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 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 f869f65e..f639521c 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1171,7 +1171,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var saveLineWidth = this._lineWidth; var origLeft = 50; - var origTop = 50; + var origTop = this.snapManager.getStageHeight() - 50; var mat = this.viewUtils.getMatrixFromElement( this._sourceSpaceElt ); var tMat = Matrix.Translation([origLeft,origTop,0]); @@ -1203,7 +1203,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.setDrawingSurfaceElement(this.application.ninja.stage.layoutCanvas); // clear just the 3d compass area this._drawingContext.save(); - this._drawingContext.rect(0, 0, 100, 100); + this._drawingContext.rect(0, origTop-50, 100, 100); this._drawingContext.clip(); this._drawingContext.lineWidth = 2.0; -- cgit v1.2.3 From 597fd83bf02d36240538a239d36ae77efdaf83bb Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 11 May 2012 10:10:37 -0700 Subject: Adjusting 3d compass's drawing location so it's not hitting the edge of the frame. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 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 f639521c..b53ac4ad 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1170,8 +1170,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var saveColor = this._lineColor; var saveLineWidth = this._lineWidth; - var origLeft = 50; - var origTop = this.snapManager.getStageHeight() - 50; + var origLeft = 60; + var origTop = this.snapManager.getStageHeight() - 60; var mat = this.viewUtils.getMatrixFromElement( this._sourceSpaceElt ); var tMat = Matrix.Translation([origLeft,origTop,0]); @@ -1203,7 +1203,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.setDrawingSurfaceElement(this.application.ninja.stage.layoutCanvas); // clear just the 3d compass area this._drawingContext.save(); - this._drawingContext.rect(0, origTop-50, 100, 100); + this._drawingContext.rect(10, origTop-60, 100, 110); this._drawingContext.clip(); this._drawingContext.lineWidth = 2.0; -- cgit v1.2.3 From 4f46850b376b2d428a3d9415b1dc69b36b875a2c Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 16 May 2012 13:06:34 -0700 Subject: Automatically add scrollbars when moving content to negative space. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 41 ++++++++++++++++++++++++++++++++------ 1 file changed, 35 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 b53ac4ad..b268b8f0 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -245,16 +245,45 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { } var els = event.detail.data.els; if(els && this._shouldUpdatePlanes(event.detail.data.prop)) { - var len = els.length; + var len = els.length, + stage = this.application.ninja.stage, + minLeft = stage.userPaddingLeft, + minTop = stage.userPaddingTop, + docLeft = stage.documentOffsetLeft, + docTop = stage.documentOffsetTop, + l, + t, + plane, + changed = false; for(var i=0; i < len; i++) { - if(els[i].elementModel.props3D.elementPlane) { - els[i].elementModel.props3D.elementPlane.init(); + plane = els[i].elementModel.props3D.elementPlane; + if(plane) { + plane.init(); + l = plane._rect.m_left - docLeft; + t = plane._rect.m_top - docTop; + if(l < minLeft) { + minLeft = l; + } + if(t < minTop) { + minTop = t; + } } } - this.application.ninja.stage.layout.draw(); - this.drawWorkingPlane(); - this.draw3DCompass(); + if(minLeft !== stage.userPaddingLeft) { + stage.userPaddingLeft = minLeft; + changed = true; + } + if(minTop !== stage.userPaddingTop) { + stage.userPaddingTop = minTop; + changed = true; + } + + if(!changed) { + stage.layout.draw(); + this.drawWorkingPlane(); + this.draw3DCompass(); + } } } }, -- cgit v1.2.3 From 727ad95f6828821f0682aa98104783e4bbda78b4 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 16 May 2012 15:56:54 -0700 Subject: Inline style for html's padding for content in negative space to guarantee highest specificity. Also, set up scrollbars when opening files with content in negative space. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 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 b268b8f0..a6d2d899 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -119,19 +119,43 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { initializeFromDocument:{ value:function(){ - var documentRootChildren = null, i; + var documentRootChildren = null, i, stage = this.application.ninja.stage; //initialize with current document this._eltArray = []; this._planesArray = []; - this.setDrawingSurfaceElement(this.application.ninja.stage.canvas); - this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage ); + this.setDrawingSurfaceElement(stage.canvas); + this.setSourceSpaceElement( stage.stageDeps.currentStage ); 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; - for(i=0;i --- js/helper-classes/3D/draw-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 a6d2d899..a8bc16ef 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -138,7 +138,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { l, t, plane, - elt + elt; for(i=0; i --- js/helper-classes/3D/draw-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 a8bc16ef..bf48a723 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( stage.stageDeps.currentStage ); + this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them -- cgit v1.2.3 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