diff options
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 35 |
1 files changed, 30 insertions, 5 deletions
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, { | |||
119 | 119 | ||
120 | initializeFromDocument:{ | 120 | initializeFromDocument:{ |
121 | value:function(){ | 121 | value:function(){ |
122 | var documentRootChildren = null, i; | 122 | var documentRootChildren = null, i, stage = this.application.ninja.stage; |
123 | //initialize with current document | 123 | //initialize with current document |
124 | this._eltArray = []; | 124 | this._eltArray = []; |
125 | this._planesArray = []; | 125 | this._planesArray = []; |
126 | this.setDrawingSurfaceElement(this.application.ninja.stage.canvas); | 126 | this.setDrawingSurfaceElement(stage.canvas); |
127 | this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage ); | 127 | this.setSourceSpaceElement( stage.stageDeps.currentStage ); |
128 | this.setWorkingPlane( [0,0,1,0] ); | 128 | this.setWorkingPlane( [0,0,1,0] ); |
129 | 129 | ||
130 | //Loop through all the top-level children of the current document and call drawUtils.addElement on them | 130 | //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){ | 131 | if(this.application.ninja.currentDocument._liveNodeList.length > 0){ |
132 | documentRootChildren = this.application.ninja.currentDocument._liveNodeList; | 132 | documentRootChildren = this.application.ninja.currentDocument._liveNodeList; |
133 | for(i=0;i<documentRootChildren.length;i++){ | 133 | var len = documentRootChildren.length, |
134 | this.addElement(documentRootChildren[i]); | 134 | minLeft = stage.userPaddingLeft, |
135 | minTop = stage.userPaddingTop, | ||
136 | docLeft = stage.documentOffsetLeft, | ||
137 | docTop = stage.documentOffsetTop, | ||
138 | l, | ||
139 | t, | ||
140 | plane, | ||
141 | elt | ||
142 | for(i=0; i<len; i++) { | ||
143 | elt = documentRootChildren[i]; | ||
144 | plane = this.addElement(elt); | ||
145 | l = plane._rect.m_left - docLeft; | ||
146 | t = plane._rect.m_top - docTop; | ||
147 | if(l < minLeft) { | ||
148 | minLeft = l; | ||
149 | } | ||
150 | if(t < minTop) { | ||
151 | minTop = t; | ||
152 | } | ||
153 | } | ||
154 | if(minLeft !== stage.userPaddingLeft) { | ||
155 | stage.userPaddingLeft = minLeft; | ||
156 | } | ||
157 | if(minTop !== stage.userPaddingTop) { | ||
158 | stage.userPaddingTop = minTop; | ||
135 | } | 159 | } |
136 | } | 160 | } |
137 | } | 161 | } |
@@ -310,6 +334,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
310 | plane.init(); | 334 | plane.init(); |
311 | this._planesArray.push( plane ); | 335 | this._planesArray.push( plane ); |
312 | elt.elementModel.props3D.elementPlane = plane; | 336 | elt.elementModel.props3D.elementPlane = plane; |
337 | return plane; | ||
313 | } | 338 | } |
314 | }, | 339 | }, |
315 | 340 | ||