diff options
author | Jose Antonio Marquez | 2012-04-16 14:37:58 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-04-16 14:37:58 -0700 |
commit | eca4a100b99c21137aa4e6954fcc963dd3b06ed6 (patch) | |
tree | 2ffa00dd02cbc63033dee45f153f0c91d210b5b6 /js/helper-classes/3D | |
parent | 9076e0540d5c3e48e1f0b2dc8f24062997e38edb (diff) | |
parent | 4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff) | |
download | ninja-eca4a100b99c21137aa4e6954fcc963dd3b06ed6.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'js/helper-classes/3D')
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 8 | ||||
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 46 |
2 files changed, 28 insertions, 26 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 61f5bc97..02e81a62 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -1354,7 +1354,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1354 | var offset = viewUtils.getElementOffset( elt ); | 1354 | var offset = viewUtils.getElementOffset( elt ); |
1355 | MathUtils.makeDimension3( offset ); | 1355 | MathUtils.makeDimension3( offset ); |
1356 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); | 1356 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); |
1357 | var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); | 1357 | var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent ); |
1358 | 1358 | ||
1359 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); | 1359 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); |
1360 | if (dist < this.ELEMENT_VERTEX_HIT_RAD) | 1360 | if (dist < this.ELEMENT_VERTEX_HIT_RAD) |
@@ -1392,7 +1392,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1392 | var offset = viewUtils.getElementOffset( elt ); | 1392 | var offset = viewUtils.getElementOffset( elt ); |
1393 | MathUtils.makeDimension3( offset ); | 1393 | MathUtils.makeDimension3( offset ); |
1394 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); | 1394 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); |
1395 | var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); | 1395 | var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent ); |
1396 | 1396 | ||
1397 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); | 1397 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); |
1398 | if (dist < this.ELEMENT_EDGE_HIT_RAD) | 1398 | if (dist < this.ELEMENT_EDGE_HIT_RAD) |
@@ -1445,7 +1445,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1445 | var offset = viewUtils.getElementOffset( elt ); | 1445 | var offset = viewUtils.getElementOffset( elt ); |
1446 | MathUtils.makeDimension3( offset ); | 1446 | MathUtils.makeDimension3( offset ); |
1447 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); | 1447 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); |
1448 | var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); | 1448 | var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent ); |
1449 | 1449 | ||
1450 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); | 1450 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); |
1451 | if (dist < this.ELEMENT_VERTEX_HIT_RAD) | 1451 | if (dist < this.ELEMENT_VERTEX_HIT_RAD) |
@@ -1483,7 +1483,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1483 | var offset = viewUtils.getElementOffset( elt ); | 1483 | var offset = viewUtils.getElementOffset( elt ); |
1484 | MathUtils.makeDimension3( offset ); | 1484 | MathUtils.makeDimension3( offset ); |
1485 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); | 1485 | var parentPt = vecUtils.vecAdd(3, scrPt, offset ); |
1486 | var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); | 1486 | var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent ); |
1487 | 1487 | ||
1488 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); | 1488 | var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); |
1489 | if (dist < this.ELEMENT_EDGE_HIT_RAD) | 1489 | if (dist < this.ELEMENT_EDGE_HIT_RAD) |
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; |