aboutsummaryrefslogtreecommitdiff
path: root/js/stage/tool-handle.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-06 10:58:25 -0800
committerValerio Virgillito2012-03-06 10:58:25 -0800
commit84332ab81c1b445195f1d9be8bbeae0725c8e758 (patch)
treee322baa1f98d4507ec255279198fa2284b2dff3c /js/stage/tool-handle.js
parent13f52cf0c74f53a919fa864f86669e8155f82961 (diff)
downloadninja-84332ab81c1b445195f1d9be8bbeae0725c8e758.tar.gz
Squashed commit of preload-fix into Master
- Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/stage/tool-handle.js')
-rwxr-xr-xjs/stage/tool-handle.js60
1 files changed, 30 insertions, 30 deletions
diff --git a/js/stage/tool-handle.js b/js/stage/tool-handle.js
index 03513de7..f16d8324 100755
--- a/js/stage/tool-handle.js
+++ b/js/stage/tool-handle.js
@@ -204,19 +204,19 @@ exports.RotateHandle = Montage.create(ToolHandle, {
204 switch(this._axis) 204 switch(this._axis)
205 { 205 {
206 case "x": 206 case "x":
207 this._vec = Vector.create([1, 0, 0]); 207 this._vec = [1, 0, 0];
208 this._vec2 = Vector.create([0, 1, 0]); 208 this._vec2 = [0, 1, 0];
209 this._vec3 = Vector.create([0, 0, 1]); 209 this._vec3 = [0, 0, 1];
210 break; 210 break;
211 case "y": 211 case "y":
212 this._vec = Vector.create([0, 1, 0]); 212 this._vec = [0, 1, 0];
213 this._vec2 = Vector.create([1, 0, 0]); 213 this._vec2 = [1, 0, 0];
214 this._vec3 = Vector.create([0, 0, 1]); 214 this._vec3 = [0, 0, 1];
215 break; 215 break;
216 case "z": 216 case "z":
217 this._vec = Vector.create([0, 0, 1]); 217 this._vec = [0, 0, 1];
218 this._vec2 = Vector.create([1, 0, 0]); 218 this._vec2 = [1, 0, 0];
219 this._vec3 = Vector.create([0, 1, 0]); 219 this._vec3 = [0, 1, 0];
220 break; 220 break;
221 } 221 }
222 222
@@ -254,7 +254,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
254 this._planeEq2 = MathUtils.transformVector(this._vec2, transMat); 254 this._planeEq2 = MathUtils.transformVector(this._vec2, transMat);
255 this._planeEq3 = MathUtils.transformVector(this._vec3, transMat); 255 this._planeEq3 = MathUtils.transformVector(this._vec3, transMat);
256 256
257 var viewVec = Vector.create([0, 0, 1]); 257 var viewVec = [0, 0, 1];
258 258
259 var angle2 = MathUtils.getAngleBetweenVectors(this._planeEq2, viewVec); 259 var angle2 = MathUtils.getAngleBetweenVectors(this._planeEq2, viewVec);
260 var angle3 = MathUtils.getAngleBetweenVectors(this._planeEq3, viewVec); 260 var angle3 = MathUtils.getAngleBetweenVectors(this._planeEq3, viewVec);
@@ -279,7 +279,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
279 279
280 context.beginPath(); 280 context.beginPath();
281 281
282 var pt = Vector.create( [this._radius, 0.0, 0.0] ); 282 var pt = [this._radius, 0.0, 0.0];
283 var pts; 283 var pts;
284 284
285 for (var i=0; i<this._nTriangles; i++) 285 for (var i=0; i<this._nTriangles; i++)
@@ -297,7 +297,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
297 // Draw the transform handle 297 // Draw the transform handle
298 context.beginPath(); 298 context.beginPath();
299 299
300 pt = Vector.create( [this._transformCenterRadius, 0.0, 0.0] ); 300 pt = [this._transformCenterRadius, 0.0, 0.0];
301 301
302 for (var i=0; i<this._nTriangles; i++) 302 for (var i=0; i<this._nTriangles; i++)
303 { 303 {
@@ -317,8 +317,8 @@ exports.RotateHandle = Montage.create(ToolHandle, {
317 317
318 collidesWithPoint: { 318 collidesWithPoint: {
319 value:function (x, y) { 319 value:function (x, y) {
320 var globalPt = Vector.create( [x, y, 0] ); 320 var globalPt = [x, y, 0];
321 var vec = Vector.create( [0,0,1] ); 321 var vec = [0,0,1];
322 322
323 // if angle between view direction and the handle's plane is within 5 degrees, use line test instead 323 // if angle between view direction and the handle's plane is within 5 degrees, use line test instead
324 var angle = MathUtils.getAngleBetweenVectors(vec, this._planeEq); 324 var angle = MathUtils.getAngleBetweenVectors(vec, this._planeEq);
@@ -339,7 +339,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
339 var t = MathUtils.parameterizePointOnLine2D( this._origin, this._dirVec, nearPt ); 339 var t = MathUtils.parameterizePointOnLine2D( this._origin, this._dirVec, nearPt );
340 if(angle !== 0) 340 if(angle !== 0)
341 { 341 {
342 var theta = MathUtils.getAngleBetweenVectors(this._dirVec, Vector.create([50, 0, 0])); 342 var theta = MathUtils.getAngleBetweenVectors(this._dirVec, [50, 0, 0]);
343 t = t * Math.cos(theta); 343 t = t * Math.cos(theta);
344 } 344 }
345 345
@@ -364,7 +364,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
364 var theta = Math.atan2(localPt[1], localPt[0]); 364 var theta = Math.atan2(localPt[1], localPt[0]);
365 var xC = this._transformCenterRadius*Math.cos(theta); 365 var xC = this._transformCenterRadius*Math.cos(theta);
366 var yC = this._transformCenterRadius*Math.sin(theta); 366 var yC = this._transformCenterRadius*Math.sin(theta);
367 var ptOnCircle = Vector.create([xC, yC, 0]); 367 var ptOnCircle = [xC, yC, 0];
368 368
369 var dist = vecUtils.vecDist( 2, localPt, ptOnCircle ); 369 var dist = vecUtils.vecDist( 2, localPt, ptOnCircle );
370 370
@@ -375,7 +375,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
375 375
376 xC = this._radius*Math.cos(theta); 376 xC = this._radius*Math.cos(theta);
377 yC = this._radius*Math.sin(theta); 377 yC = this._radius*Math.sin(theta);
378 ptOnCircle = Vector.create([xC, yC, 0]); 378 ptOnCircle = [xC, yC, 0];
379 379
380 dist = vecUtils.vecDist( 2, localPt, ptOnCircle ); 380 dist = vecUtils.vecDist( 2, localPt, ptOnCircle );
381 381
@@ -395,7 +395,7 @@ exports.RotateHandle = Montage.create(ToolHandle, {
395 var theta = Math.atan2(localPt[1], localPt[0]); 395 var theta = Math.atan2(localPt[1], localPt[0]);
396 var xC = this._radius*Math.cos(theta); 396 var xC = this._radius*Math.cos(theta);
397 var yC = this._radius*Math.sin(theta); 397 var yC = this._radius*Math.sin(theta);
398 var pt = Vector.create([xC, yC, 0]); 398 var pt = [xC, yC, 0];
399 399
400 var context = this.application.ninja.stage.drawingContext; 400 var context = this.application.ninja.stage.drawingContext;
401 context.save(); 401 context.save();
@@ -548,19 +548,19 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
548 switch(this._axis) 548 switch(this._axis)
549 { 549 {
550 case "x": 550 case "x":
551 this._vec = Vector.create([1, 0, 0]); 551 this._vec = [1, 0, 0];
552 this._vec2 = Vector.create([0, 1, 0]); 552 this._vec2 = [0, 1, 0];
553 this._vec3 = Vector.create([0, 0, 1]); 553 this._vec3 = [0, 0, 1];
554 break; 554 break;
555 case "y": 555 case "y":
556 this._vec = Vector.create([0, -1, 0]); 556 this._vec = [0, -1, 0];
557 this._vec2 = Vector.create([1, 0, 0]); 557 this._vec2 = [1, 0, 0];
558 this._vec3 = Vector.create([0, 0, 1]); 558 this._vec3 = [0, 0, 1];
559 break; 559 break;
560 case "z": 560 case "z":
561 this._vec = Vector.create([0, 0, 1]); 561 this._vec = [0, 0, 1];
562 this._vec2 = Vector.create([1, 0, 0]); 562 this._vec2 = [1, 0, 0];
563 this._vec3 = Vector.create([0, 1, 0]); 563 this._vec3 = [0, 1, 0];
564 break; 564 break;
565 } 565 }
566 } 566 }
@@ -592,7 +592,7 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
592 this._planeEq2 = MathUtils.transformVector(this._vec2, transMat); 592 this._planeEq2 = MathUtils.transformVector(this._vec2, transMat);
593 this._planeEq3 = MathUtils.transformVector(this._vec3, transMat); 593 this._planeEq3 = MathUtils.transformVector(this._vec3, transMat);
594 594
595 var viewVec = Vector.create([0, 0, 1]); 595 var viewVec = [0, 0, 1];
596 596
597 var angle2 = MathUtils.getAngleBetweenVectors(this._planeEq2, viewVec); 597 var angle2 = MathUtils.getAngleBetweenVectors(this._planeEq2, viewVec);
598 var angle3 = MathUtils.getAngleBetweenVectors(this._planeEq3, viewVec); 598 var angle3 = MathUtils.getAngleBetweenVectors(this._planeEq3, viewVec);
@@ -615,7 +615,7 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
615 615
616 context.beginPath(); 616 context.beginPath();
617 617
618 var pt = Vector.create([0.0, 0.0, 0.0]); 618 var pt = [0.0, 0.0, 0.0];
619 var pts = MathUtils.transformPoint(pt, this._matW); 619 var pts = MathUtils.transformPoint(pt, this._matW);
620 620
621 context.moveTo(pts[0], pts[1]); 621 context.moveTo(pts[0], pts[1]);
@@ -697,7 +697,7 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
697 { 697 {
698 value:function (x, y) 698 value:function (x, y)
699 { 699 {
700 var globalPt = Vector.create( [x, y, this._origin[2]] ); 700 var globalPt = [x, y, this._origin[2]];
701 701
702 // test for a hit on the origin 702 // test for a hit on the origin
703 var dist = vecUtils.vecDist( 2, globalPt, this._origin ); 703 var dist = vecUtils.vecDist( 2, globalPt, this._origin );