aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/view-utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/3D/view-utils.js')
-rwxr-xr-xjs/helper-classes/3D/view-utils.js46
1 files changed, 24 insertions, 22 deletions
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 55ecbc59..1cd1c313 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -259,7 +259,7 @@ exports.ViewUtils = Montage.create(Component, {
259 259
260 // transform the point up the tree 260 // transform the point up the tree
261 var child = elt; 261 var child = elt;
262 var parent = elt.parentElement; 262 var parent = elt.offsetParent;
263 while ( parent ) 263 while ( parent )
264 { 264 {
265 // go to screen space of the current child 265 // go to screen space of the current child
@@ -287,7 +287,7 @@ exports.ViewUtils = Montage.create(Component, {
287 } 287 }
288 288
289 child = parent; 289 child = parent;
290 parent = parent.parentElement; 290 parent = parent.offsetParent;
291 } 291 }
292 292
293 return pt; 293 return pt;
@@ -303,7 +303,7 @@ exports.ViewUtils = Montage.create(Component, {
303 303
304 // transform the bounds up the tree 304 // transform the bounds up the tree
305 var child = elt; 305 var child = elt;
306 var parent = elt.parentElement; 306 var parent = elt.offsetParent;
307 while ( parent ) 307 while ( parent )
308 { 308 {
309 pt = this.childToParent( pt, child ); 309 pt = this.childToParent( pt, child );
@@ -311,7 +311,7 @@ exports.ViewUtils = Montage.create(Component, {
311 if (parent === this._rootElement) break; 311 if (parent === this._rootElement) break;
312 312
313 child = parent; 313 child = parent;
314 parent = parent.parentElement; 314 parent = parent.offsetParent;
315 } 315 }
316 316
317 ///////////////////////////////////////////////////////// 317 /////////////////////////////////////////////////////////
@@ -346,7 +346,7 @@ exports.ViewUtils = Montage.create(Component, {
346 if (pt.length == 2) pt[2] = 0; 346 if (pt.length == 2) pt[2] = 0;
347 347
348 // transform the bounds up the tree 348 // transform the bounds up the tree
349 var parent = child.parentElement; 349 var parent = child.offsetParent;
350 if ( parent ) 350 if ( parent )
351 { 351 {
352 this.setViewportObj( child ); 352 this.setViewportObj( child );
@@ -394,7 +394,7 @@ exports.ViewUtils = Montage.create(Component, {
394 pt[3] = 1; 394 pt[3] = 1;
395 395
396 // transform the bounds up the tree 396 // transform the bounds up the tree
397 var parent = child.parentElement; 397 var parent = child.offsetParent;
398 if ( parent ) 398 if ( parent )
399 { 399 {
400 this.setViewportObj( child ); 400 this.setViewportObj( child );
@@ -429,7 +429,7 @@ exports.ViewUtils = Montage.create(Component, {
429 429
430 /* 430 /*
431 this.pushViewportObj( elt ); 431 this.pushViewportObj( elt );
432 var parent = elt.parentElement; 432 var parent = elt.offsetParent;
433 var offset = this.getElementOffset( elt ); 433 var offset = this.getElementOffset( elt );
434 offset[2] = 0; 434 offset[2] = 0;
435 var localEyePt = this.getCenterOfProjection(); 435 var localEyePt = this.getCenterOfProjection();
@@ -603,19 +603,6 @@ exports.ViewUtils = Montage.create(Component, {
603 w = elt.offsetWidth, 603 w = elt.offsetWidth,
604 h = elt.offsetHeight; 604 h = elt.offsetHeight;
605 605
606 if(elt.width)
607 w = elt.width;
608 if(elt.height)
609 h = elt.height;
610
611 if (elt.style)
612 {
613 if (elt.style.left) left = MathUtils.styleToNumber(elt.style.left);
614 if (elt.style.top) top = MathUtils.styleToNumber(elt.style.top);
615 if (elt.style.width) w = MathUtils.styleToNumber(elt.style.width);
616 if (elt.style.height) h = MathUtils.styleToNumber(elt.style.height);
617 }
618
619// if (elt instanceof SVGSVGElement) { 606// if (elt instanceof SVGSVGElement) {
620 if(elt.nodeName.toLowerCase() === "svg") { 607 if(elt.nodeName.toLowerCase() === "svg") {
621 if(w instanceof SVGAnimatedLength) 608 if(w instanceof SVGAnimatedLength)
@@ -658,6 +645,21 @@ exports.ViewUtils = Montage.create(Component, {
658 // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff; 645 // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff;
659 // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff; 646 // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff;
660 var offset = [xOff, yOff]; 647 var offset = [xOff, yOff];
648 if(elt.offsetParent && (elt.offsetParent !== this._stageElement))
649 {
650 var pS = elt.ownerDocument.defaultView.getComputedStyle(elt.offsetParent);
651
652 var border = parseInt(pS.getPropertyValue("border"));
653
654 if(border)
655 {
656 var bl = parseInt(pS.getPropertyValue("border-left-width")),
657 bt = parseInt(pS.getPropertyValue("border-top-width"));
658
659 offset[0] += bl;
660 offset[1] += bt;
661 }
662 }
661 663
662 if(elt === this._stageElement) 664 if(elt === this._stageElement)
663 { 665 {
@@ -987,7 +989,7 @@ exports.ViewUtils = Montage.create(Component, {
987 989
988 if (elt === this._stageElement) break; 990 if (elt === this._stageElement) break;
989 if (elt === this._rootElement) break; 991 if (elt === this._rootElement) break;
990 elt = elt.parentElement; 992 elt = elt.offsetParent;
991 if (elt === this._rootElement) break; 993 if (elt === this._rootElement) break;
992 } 994 }
993 995
@@ -1040,7 +1042,7 @@ exports.ViewUtils = Montage.create(Component, {
1040 //mat = offMat.multiply( mat ); 1042 //mat = offMat.multiply( mat );
1041 glmat4.multiply( offMat, mat, mat ); 1043 glmat4.multiply( offMat, mat, mat );
1042 1044
1043 elt = elt.parentElement; 1045 elt = elt.offsetParent;
1044 } 1046 }
1045 1047
1046 return mat; 1048 return mat;