diff options
Diffstat (limited to 'js/helper-classes/3D/view-utils.js')
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 5a128408..d7f29caa 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -244,6 +244,38 @@ exports.ViewUtils = Montage.create(Component, { | |||
244 | } | 244 | } |
245 | }, | 245 | }, |
246 | 246 | ||
247 | getElementBoundsInGlobal: { | ||
248 | value: function (elt) { | ||
249 | this.pushViewportObj(elt); | ||
250 | var bounds3D = this.getElementViewBounds3D(elt); | ||
251 | var tmpMat = this.getLocalToGlobalMatrix(elt); | ||
252 | |||
253 | var zoomFactor = 1; | ||
254 | var stage = this.application.ninja.stage; | ||
255 | if (stage._viewport && stage._viewport.style && stage._viewport.style.zoom) { | ||
256 | zoomFactor = Number(stage._viewport.style.zoom); | ||
257 | } | ||
258 | |||
259 | var sSL = stage._scrollLeft; | ||
260 | var sST = stage._scrollTop; | ||
261 | |||
262 | for (var j=0; j<4; j++) { | ||
263 | var localPt = bounds3D[j]; | ||
264 | var tmpPt = this.localToGlobal2(localPt, tmpMat); | ||
265 | |||
266 | if(zoomFactor !== 1) { | ||
267 | tmpPt = vecUtils.vecScale(3, tmpPt, zoomFactor); | ||
268 | |||
269 | tmpPt[0] += sSL*(zoomFactor - 1); | ||
270 | tmpPt[1] += sST*(zoomFactor - 1); | ||
271 | } | ||
272 | bounds3D[j] = tmpPt; | ||
273 | } | ||
274 | this.popViewportObj(); | ||
275 | return bounds3D; | ||
276 | } | ||
277 | }, | ||
278 | |||
247 | getCenterOfProjection: { | 279 | getCenterOfProjection: { |
248 | value: function() { | 280 | value: function() { |
249 | var cop; | 281 | var cop; |