aboutsummaryrefslogtreecommitdiff
path: root/js/stage/tool-handle.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage/tool-handle.js')
-rwxr-xr-xjs/stage/tool-handle.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/js/stage/tool-handle.js b/js/stage/tool-handle.js
index 5ce243ff..ecd16951 100755
--- a/js/stage/tool-handle.js
+++ b/js/stage/tool-handle.js
@@ -111,7 +111,7 @@ var ToolHandle = exports.ToolHandle = Montage.create(Component, {
111 return true; 111 return true;
112 } 112 }
113 } 113 }
114 114
115}); 115});
116 116
117 117
@@ -302,7 +302,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
302 this._planeEq[3] = -vecUtils.vecDot(3, this._planeEq, this._origin); 302 this._planeEq[3] = -vecUtils.vecDot(3, this._planeEq, this._origin);
303 303
304 this._dirVecL = MathUtils.transformPoint(this._dirVec, this._matL); 304 this._dirVecL = MathUtils.transformPoint(this._dirVec, this._matL);
305 305
306 context.beginPath(); 306 context.beginPath();
307 307
308 var pt = [this._radius, 0.0, 0.0]; 308 var pt = [this._radius, 0.0, 0.0];
@@ -322,7 +322,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
322 322
323 // Draw the transform handle 323 // Draw the transform handle
324 context.beginPath(); 324 context.beginPath();
325 325
326 pt = [this._transformCenterRadius, 0.0, 0.0]; 326 pt = [this._transformCenterRadius, 0.0, 0.0];
327 327
328 for (var i=0; i<this._nTriangles; i++) 328 for (var i=0; i<this._nTriangles; i++)
@@ -336,7 +336,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
336 context.stroke(); 336 context.stroke();
337 337
338 338
339 339
340 context.restore(); 340 context.restore();
341 } 341 }
342 }, 342 },
@@ -384,7 +384,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
384 384
385 return 0; 385 return 0;
386 } 386 }
387 387
388 localPt = MathUtils.transformPoint(localPt, this._matL); 388 localPt = MathUtils.transformPoint(localPt, this._matL);
389 389
390 var theta = Math.atan2(localPt[1], localPt[0]); 390 var theta = Math.atan2(localPt[1], localPt[0]);
@@ -398,13 +398,13 @@ exports.RotateHandle = Montage.create(ToolHandle, {
398 { 398 {
399 return 1; 399 return 1;
400 } 400 }
401 401
402 xC = this._radius*Math.cos(theta); 402 xC = this._radius*Math.cos(theta);
403 yC = this._radius*Math.sin(theta); 403 yC = this._radius*Math.sin(theta);
404 ptOnCircle = [xC, yC, 0]; 404 ptOnCircle = [xC, yC, 0];
405 405
406 dist = vecUtils.vecDist( 2, localPt, ptOnCircle ); 406 dist = vecUtils.vecDist( 2, localPt, ptOnCircle );
407 407
408 if ( dist <= 5 ) 408 if ( dist <= 5 )
409 { 409 {
410 return 2; 410 return 2;
@@ -414,7 +414,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
414 } 414 }
415 }, 415 },
416 416
417 417
418 drawShadedAngle: { 418 drawShadedAngle: {
419 value: function(angle, localPt) { 419 value: function(angle, localPt) {
420 420
@@ -448,7 +448,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
448 } 448 }
449 449
450 context.lineTo(this._origin[0], this._origin[1]); 450 context.lineTo(this._origin[0], this._origin[1]);
451 451
452 context.stroke(); 452 context.stroke();
453 context.fill(); 453 context.fill();
454 454
@@ -675,7 +675,7 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
675 context.stroke(); 675 context.stroke();
676 676
677 this._drawArrowHead(this._origin, this._endPt, context); 677 this._drawArrowHead(this._origin, this._endPt, context);
678 678
679 context.restore(); 679 context.restore();
680 } 680 }
681 }, 681 },
@@ -734,23 +734,23 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
734 context.restore(); 734 context.restore();
735 } 735 }
736 }, 736 },
737 737
738 collidesWithPoint: 738 collidesWithPoint:
739 { 739 {
740 value:function (x, y) 740 value:function (x, y)
741 { 741 {
742 var globalPt = [x, y, this._origin[2]]; 742 var globalPt = [x, y, this._origin[2]];
743 743
744 // test for a hit on the origin 744 // test for a hit on the origin
745 var dist = vecUtils.vecDist( 2, globalPt, this._origin ); 745 var dist = vecUtils.vecDist( 2, globalPt, this._origin );
746 if (dist <= 5) return 1; 746 if (dist <= 5) return 1;
747 747
748 var nearPt = MathUtils.nearestPointOnLine2D( this._origin, this._dirVec, globalPt ); 748 var nearPt = MathUtils.nearestPointOnLine2D( this._origin, this._dirVec, globalPt );
749 if(!nearPt) 749 if(!nearPt)
750 { 750 {
751 return 0; 751 return 0;
752 } 752 }
753 753
754 var t = MathUtils.parameterizePointOnLine2D( this._origin, this._dirVec, nearPt ); 754 var t = MathUtils.parameterizePointOnLine2D( this._origin, this._dirVec, nearPt );
755 dist = vecUtils.vecDist( 2, globalPt, nearPt ); 755 dist = vecUtils.vecDist( 2, globalPt, nearPt );
756 if (dist <= 5) 756 if (dist <= 5)