aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-04-16 14:37:58 -0700
committerJose Antonio Marquez2012-04-16 14:37:58 -0700
commiteca4a100b99c21137aa4e6954fcc963dd3b06ed6 (patch)
tree2ffa00dd02cbc63033dee45f153f0c91d210b5b6 /js
parent9076e0540d5c3e48e1f0b2dc8f24062997e38edb (diff)
parent4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff)
downloadninja-eca4a100b99c21137aa4e6954fcc963dd3b06ed6.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/element-controller.js4
-rwxr-xr-xjs/data/pi/pi-data.js2
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js8
-rwxr-xr-xjs/helper-classes/3D/view-utils.js46
4 files changed, 34 insertions, 26 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 7ab6664f..2ac84452 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -264,6 +264,10 @@ exports.ElementController = Montage.create(Component, {
264 "-webkit-transform", 264 "-webkit-transform",
265 "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); 265 "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")");
266 266
267 this.application.ninja.stylesController.setElementStyle(el,
268 "-webkit-transform-style",
269 "preserve-3d");
270
267 // TODO - We don't support perspective on individual elements yet 271 // TODO - We don't support perspective on individual elements yet
268// this.application.ninja.stylesController.setElementStyle(el, 272// this.application.ninja.stylesController.setElementStyle(el,
269// "-webkit-perspective", 273// "-webkit-perspective",
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index 07017f09..157c54ec 100755
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -131,6 +131,8 @@ exports.PiData = Montage.create( Montage, {
131 type : "hottext", 131 type : "hottext",
132 id : "borderWidth", 132 id : "borderWidth",
133 prop : "border-width", 133 prop : "border-width",
134 defaultValue: 0,
135 valueMutator: parseFloat,
134 label : "Border", 136 label : "Border",
135 min : 0, 137 min : 0,
136 max : 100, 138 max : 100,
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