aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLLine.js
diff options
context:
space:
mode:
authorhwc4872012-02-23 16:57:55 -0800
committerhwc4872012-02-23 16:57:55 -0800
commitd0661d6c587aced68a68e36a5ec4e81f8a2096e8 (patch)
tree3fd0caf1c4286d0e8f0774b7a230b4dfb09f6167 /js/helper-classes/RDGE/GLLine.js
parent26bb2894c29d4608e843de01829d352dd3d00823 (diff)
downloadninja-d0661d6c587aced68a68e36a5ec4e81f8a2096e8.tar.gz
bug fixes for canvas 2d shape drawing.
Diffstat (limited to 'js/helper-classes/RDGE/GLLine.js')
-rwxr-xr-xjs/helper-classes/RDGE/GLLine.js57
1 files changed, 28 insertions, 29 deletions
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js
index f715a43c..5228ac09 100755
--- a/js/helper-classes/RDGE/GLLine.js
+++ b/js/helper-classes/RDGE/GLLine.js
@@ -364,41 +364,40 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
364 var lineWidth = this._strokeWidth; 364 var lineWidth = this._strokeWidth;
365 ctx.beginPath(); 365 ctx.beginPath();
366 ctx.lineWidth = lineWidth; 366 ctx.lineWidth = lineWidth;
367 ctx.strokeStyle = "#0000ff";
368 if (this._strokeColor) 367 if (this._strokeColor)
369 { 368 {
370 var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")"; 369 var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")";
371 ctx.strokeStyle = c; 370 ctx.strokeStyle = c;
372 }
373 371
374 // get the points 372 // get the points
375 var p0, p1; 373 var p0, p1;
376 var w = this._width, h = this._height; 374 var w = this._width, h = this._height;
377 if(this._slope === "vertical") 375 if(this._slope === "vertical")
378 { 376 {
379 p0 = [0.5*w, 0]; 377 p0 = [0.5*w, 0];
380 p1 = [0.5*w, h]; 378 p1 = [0.5*w, h];
381 } 379 }
382 else if(this._slope === "horizontal") 380 else if(this._slope === "horizontal")
383 { 381 {
384 p0 = [0, 0.5*h]; 382 p0 = [0, 0.5*h];
385 p1 = [w, 0.5*h]; 383 p1 = [w, 0.5*h];
386 } 384 }
387 else if(this._slope > 0) 385 else if(this._slope > 0)
388 { 386 {
389 p0 = [this._xAdj, this._yAdj]; 387 p0 = [this._xAdj, this._yAdj];
390 p1 = [w - this._xAdj, h - this._yAdj]; 388 p1 = [w - this._xAdj, h - this._yAdj];
391 } 389 }
392 else 390 else
393 { 391 {
394 p0 = [this._xAdj, h - this._yAdj]; 392 p0 = [this._xAdj, h - this._yAdj];
395 p1 = [w - this._xAdj, this._yAdj]; 393 p1 = [w - this._xAdj, this._yAdj];
396 } 394 }
397 395
398 // draw the line 396 // draw the line
399 ctx.moveTo( p0[0], p0[1] ); 397 ctx.moveTo( p0[0], p0[1] );
400 ctx.lineTo( p1[0], p1[1] ); 398 ctx.lineTo( p1[0], p1[1] );
401 ctx.stroke(); 399 ctx.stroke();
400 }
402 } 401 }
403 402
404 403