diff options
author | Eric Guzman | 2012-05-25 16:37:43 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-25 16:37:43 -0700 |
commit | e884d2769a53dd8920b485672631b50158ed0800 (patch) | |
tree | 526934085f973f0bcfef5a3f130794530396aa03 /js/helper-classes/3D/draw-utils.js | |
parent | 1f7c17d688c3340b31d2e1c2b7205b10bd806968 (diff) | |
parent | 81239571c538f72e398fafa5b07725bf1bbb2d5d (diff) | |
download | ninja-e884d2769a53dd8920b485672631b50158ed0800.tar.gz |
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'js/helper-classes/3D/draw-utils.js')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index bf48a723..871b832d 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -119,20 +119,23 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
119 | 119 | ||
120 | initializeFromDocument:{ | 120 | initializeFromDocument:{ |
121 | value:function(){ | 121 | value:function(){ |
122 | var documentRootChildren = null, i, stage = this.application.ninja.stage; | 122 | var i, |
123 | documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), | ||
124 | stage = this.application.ninja.stage, | ||
125 | len = documentRootChildren.length; | ||
123 | //initialize with current document | 126 | //initialize with current document |
124 | this._eltArray = []; | 127 | this._eltArray = []; |
125 | this._planesArray = []; | 128 | this._planesArray = []; |
126 | this.setDrawingSurfaceElement(stage.canvas); | 129 | this.setDrawingSurfaceElement(stage.canvas); |
127 | this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); | 130 | this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); |
128 | this.setWorkingPlane( [0,0,1,0] ); | 131 | this.setWorkingPlane( [0,0,1,0] ); |
129 | 132 | ||
130 | //Loop through all the top-level children of the current document and call drawUtils.addElement on them | 133 | //Loop through all the top-level children of the current document and call drawUtils.addElement on them |
131 | if(this.application.ninja.currentDocument._liveNodeList.length > 0){ | 134 | if(len > 0) { |
132 | documentRootChildren = this.application.ninja.currentDocument._liveNodeList; | 135 | var initL = 0, |
133 | var len = documentRootChildren.length, | 136 | initT = 0, |
134 | minLeft = stage.userPaddingLeft, | 137 | minLeft = 0, |
135 | minTop = stage.userPaddingTop, | 138 | minTop = 0, |
136 | docLeft = stage.documentOffsetLeft, | 139 | docLeft = stage.documentOffsetLeft, |
137 | docTop = stage.documentOffsetTop, | 140 | docTop = stage.documentOffsetTop, |
138 | l, | 141 | l, |
@@ -151,10 +154,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
151 | minTop = t; | 154 | minTop = t; |
152 | } | 155 | } |
153 | } | 156 | } |
154 | if(minLeft !== stage.userPaddingLeft) { | 157 | if(minLeft !== initL) { |
155 | stage.userPaddingLeft = minLeft; | 158 | stage.userPaddingLeft = minLeft; |
156 | } | 159 | } |
157 | if(minTop !== stage.userPaddingTop) { | 160 | if(minTop !== initT) { |
158 | stage.userPaddingTop = minTop; | 161 | stage.userPaddingTop = minTop; |
159 | } | 162 | } |
160 | } | 163 | } |
@@ -697,7 +700,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
697 | this._lineColor = saveColor; | 700 | this._lineColor = saveColor; |
698 | this._drawingContext.lineWidth = saveLineWidth; | 701 | this._drawingContext.lineWidth = saveLineWidth; |
699 | 702 | ||
700 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | 703 | if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { |
701 | // draw an outline around the body | 704 | // draw an outline around the body |
702 | var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); | 705 | var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); |
703 | var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); | 706 | var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); |
@@ -815,7 +818,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
815 | // draw the lines | 818 | // draw the lines |
816 | var line, | 819 | var line, |
817 | nLines = this._gridLineArray.length; | 820 | nLines = this._gridLineArray.length; |
818 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | 821 | if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { |
819 | nLines = this._gridLineArray.length-4; | 822 | nLines = this._gridLineArray.length-4; |
820 | } | 823 | } |
821 | 824 | ||
@@ -824,7 +827,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
824 | this.drawIntersectedLine(line, this._drawingContext); | 827 | this.drawIntersectedLine(line, this._drawingContext); |
825 | } | 828 | } |
826 | 829 | ||
827 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | 830 | if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { |
828 | this._lineColor = "red"; | 831 | this._lineColor = "red"; |
829 | i = nLines; | 832 | i = nLines; |
830 | nLines += 4; | 833 | nLines += 4; |
@@ -923,7 +926,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
923 | // if all of the planes are aligned, check if they are aligned with the view direction | 926 | // if all of the planes are aligned, check if they are aligned with the view direction |
924 | if (flat) | 927 | if (flat) |
925 | { | 928 | { |
926 | var stage = this.application.ninja.currentDocument.documentRoot; | 929 | var stage = this.application.ninja.currentDocument.model.documentRoot; |
927 | var stageMat = this.viewUtils.getMatrixFromElement(stage); | 930 | var stageMat = this.viewUtils.getMatrixFromElement(stage); |
928 | var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; | 931 | var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; |
929 | viewDir = vecUtils.vecNormalize( 3, viewDir ); | 932 | viewDir = vecUtils.vecNormalize( 3, viewDir ); |
@@ -1213,7 +1216,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1213 | value: function() { | 1216 | value: function() { |
1214 | // set the element to be the viewport object - temporarily | 1217 | // set the element to be the viewport object - temporarily |
1215 | var tmpCanvas = this.application.ninja.stage.canvas; | 1218 | var tmpCanvas = this.application.ninja.stage.canvas; |
1216 | var tmpStage = this.application.ninja.currentDocument.documentRoot; | 1219 | var tmpStage = this.application.ninja.currentDocument.model.documentRoot; |
1217 | this.viewUtils.pushViewportObj( tmpCanvas ); | 1220 | this.viewUtils.pushViewportObj( tmpCanvas ); |
1218 | 1221 | ||
1219 | // save the source space object and set to the target object | 1222 | // save the source space object and set to the target object |