diff options
author | Jose Antonio Marquez | 2012-06-22 16:21:25 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-22 16:21:25 -0700 |
commit | 7fd53b9676f51c60c139a9b48b0256184883191a (patch) | |
tree | 22985c8362329c2a3b9aeb2be49c1b84817ce7d6 /js/helper-classes/3D/view-utils.js | |
parent | d6360c39f6cd90dd5e9a1d5ef5bd5211641dad42 (diff) | |
parent | f5b8f2cc5f2b7e9cff892d7487ce56019bf66d4c (diff) | |
download | ninja-7fd53b9676f51c60c139a9b48b0256184883191a.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into FileIO
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; |