diff options
author | hwc487 | 2012-06-12 15:52:35 -0700 |
---|---|---|
committer | hwc487 | 2012-06-12 15:52:35 -0700 |
commit | 9490f816924e9e9c9970ef9384241c07ec0a6e9f (patch) | |
tree | f44449a2e0055e21960a5513fb3a0738a91db528 /js/helper-classes | |
parent | b7a41cbd5a30d32f524ee60e2dfdf9c65c7ec55b (diff) | |
parent | 6854a72504f57903bd5de003e377f2aefb02d0da (diff) | |
download | ninja-9490f816924e9e9c9970ef9384241c07ec0a6e9f.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
assets/canvas-runtime.js
js/io/system/ninjalibrary.json
js/mediators/element-mediator.js
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 4 | ||||
-rwxr-xr-x | js/helper-classes/3D/math-utils.js | 11 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 20 |
3 files changed, 13 insertions, 22 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index eef28dce..bef1e435 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -1206,7 +1206,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1206 | // set the element to be the viewport object - temporarily | 1206 | // set the element to be the viewport object - temporarily |
1207 | var tmpCanvas = this.application.ninja.stage.canvas; | 1207 | var tmpCanvas = this.application.ninja.stage.canvas; |
1208 | var tmpStage = this.application.ninja.currentDocument.model.documentRoot; | 1208 | var tmpStage = this.application.ninja.currentDocument.model.documentRoot; |
1209 | this.viewUtils.pushViewportObj( tmpCanvas ); | 1209 | // this.viewUtils.pushViewportObj( tmpCanvas ); |
1210 | 1210 | ||
1211 | // save the source space object and set to the target object | 1211 | // save the source space object and set to the target object |
1212 | var saveSource = this._sourceSpaceElt; | 1212 | var saveSource = this._sourceSpaceElt; |
@@ -1279,7 +1279,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1279 | this.drawArrowHead(rO, zO); | 1279 | this.drawArrowHead(rO, zO); |
1280 | 1280 | ||
1281 | // restore the state | 1281 | // restore the state |
1282 | this.viewUtils.popViewportObj(); | 1282 | // this.viewUtils.popViewportObj(); |
1283 | this._drawingContext.restore(); | 1283 | this._drawingContext.restore(); |
1284 | this.setDrawingSurfaceElement(saveContext); | 1284 | this.setDrawingSurfaceElement(saveContext); |
1285 | this._lineColor = saveColor; | 1285 | this._lineColor = saveColor; |
diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js index 2f0283a9..35ee8112 100755 --- a/js/helper-classes/3D/math-utils.js +++ b/js/helper-classes/3D/math-utils.js | |||
@@ -928,17 +928,18 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, { | |||
928 | return 0; | 928 | return 0; |
929 | } | 929 | } |
930 | //TODO testing...remove this block | 930 | //TODO testing...remove this block |
931 | console.log("getAxisAngleBetween3DVectors Angle: "+angle); | ||
932 | if (isNaN(angle)){ | 931 | if (isNaN(angle)){ |
933 | console.log("getAxisAngleBetween3DVectors Angle is NaN"); | 932 | console.log("Warning! getAxisAngleBetween3DVectors Angle is NaN"); |
934 | } | 933 | } |
935 | //TODO end testing block | 934 | //TODO end testing block |
936 | //optionally, if axis is provided, create the axis of rotation as well | 935 | //optionally, if axis is provided, create the axis of rotation as well |
937 | var rotAxis = VecUtils.vecCross(3, v1n, v2n); | 936 | var rotAxis = VecUtils.vecCross(3, v1n, v2n); |
938 | rotAxis = VecUtils.vecNormalize(3, rotAxis, 1); | 937 | rotAxis = VecUtils.vecNormalize(3, rotAxis, 1); |
939 | axis[0] = rotAxis[0]; | 938 | if (axis){ |
940 | axis[1] = rotAxis[1]; | 939 | axis[0] = rotAxis[0]; |
941 | axis[2] = rotAxis[2]; | 940 | axis[1] = rotAxis[1]; |
941 | axis[2] = rotAxis[2]; | ||
942 | } | ||
942 | return angle; | 943 | return angle; |
943 | } | 944 | } |
944 | }, | 945 | }, |
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index e3756f32..0157140f 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -481,10 +481,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
481 | { | 481 | { |
482 | var snapRec = this._elementCache[i]; | 482 | var snapRec = this._elementCache[i]; |
483 | var elt = snapRec.getElement(); | 483 | var elt = snapRec.getElement(); |
484 | if (elt.elementModel) | 484 | elt.elementModel.isIn2DSnapCache = false; |
485 | elt.elementModel.isIn2DSnapCache = false; | 485 | |
486 | else | ||
487 | console.log( "element in the 2D cache does not have an elementModel" ); | ||
488 | } | 486 | } |
489 | 487 | ||
490 | this._elementCache = null; | 488 | this._elementCache = null; |
@@ -498,7 +496,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
498 | this._elementCache = new Array; | 496 | this._elementCache = new Array; |
499 | 497 | ||
500 | // var stage = this.getStage(); | 498 | // var stage = this.getStage(); |
501 | var stage = this.application.ninja.currentSelectedContainer || this.getStage(); | 499 | var stage = this.application.ninja.currentDocument.model.domContainer || this.getStage(); |
502 | this.hLoadElementCache( stage, plane, 0 ); | 500 | this.hLoadElementCache( stage, plane, 0 ); |
503 | this._isCacheInvalid = false; | 501 | this._isCacheInvalid = false; |
504 | 502 | ||
@@ -541,10 +539,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
541 | snapRec.init( elt ); | 539 | snapRec.init( elt ); |
542 | this._elementCache.push( snapRec ); | 540 | this._elementCache.push( snapRec ); |
543 | 541 | ||
544 | if (!elt.elementModel) | ||
545 | { | ||
546 | NJUtils.makeModelFromElement(elt); | ||
547 | } | ||
548 | elt.elementModel.isIn2DSnapCache = true; | 542 | elt.elementModel.isIn2DSnapCache = true; |
549 | } | 543 | } |
550 | else if (elt.elementModel) | 544 | else if (elt.elementModel) |
@@ -613,10 +607,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
613 | snapRec.init( elt ); | 607 | snapRec.init( elt ); |
614 | this._elementCache.push( snapRec ); | 608 | this._elementCache.push( snapRec ); |
615 | 609 | ||
616 | if (!elt.elementModel) | ||
617 | { | ||
618 | NJUtils.makeModelFromElement(elt); | ||
619 | } | ||
620 | elt.elementModel.isIn2DSnapCache = true; | 610 | elt.elementModel.isIn2DSnapCache = true; |
621 | } | 611 | } |
622 | else if (elt.elementModel) | 612 | else if (elt.elementModel) |
@@ -997,7 +987,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
997 | value: function( screenPt, hitRecs ) { | 987 | value: function( screenPt, hitRecs ) { |
998 | // start at the stage. | 988 | // start at the stage. |
999 | // var stage = this.getStage(); | 989 | // var stage = this.getStage(); |
1000 | var stage = this.application.ninja.currentSelectedContainer || this.getStage(); | 990 | var stage = this.application.ninja.currentDocument.model.domContainer || this.getStage(); |
1001 | 991 | ||
1002 | // the root should be the 'view' canvas, so the first matrix is the camera | 992 | // the root should be the 'view' canvas, so the first matrix is the camera |
1003 | viewUtils.setViewportObj( stage ); | 993 | viewUtils.setViewportObj( stage ); |
@@ -1019,7 +1009,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1019 | } | 1009 | } |
1020 | // hit test the current object | 1010 | // hit test the current object |
1021 | var hit; | 1011 | var hit; |
1022 | var snapToStage = ((depth === 0) && (elt === this.application.ninja.currentSelectedContainer) && (elt.nodeName === 'CANVAS')); | 1012 | var snapToStage = ((depth === 0) && (elt === this.application.ninja.currentDocument.model.domContainer) && (elt.nodeName === 'CANVAS')); |
1023 | if ((depth > 0) || snapToStage) // don't snap to the root unles we are working inside a canvas | 1013 | if ((depth > 0) || snapToStage) // don't snap to the root unles we are working inside a canvas |
1024 | { | 1014 | { |
1025 | // if the element is in the 2D cache snapping is done there | 1015 | // if the element is in the 2D cache snapping is done there |