aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/line.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-08-15 14:52:25 -0700
committerValerio Virgillito2012-08-15 14:52:25 -0700
commit34804fa77191a08fcdaa8ca1992b38e60094f3ae (patch)
tree9eafadc20bb792b4058572ff1e12440428fe7c74 /js/lib/geom/line.js
parenta9ff54e7490761a7c0ad572d060ee386179d11df (diff)
parentc88752d621069b12f978c1fd88ffdd52537a4657 (diff)
downloadninja-34804fa77191a08fcdaa8ca1992b38e60094f3ae.tar.gz
Merge branch 'refs/heads/v0.7.2'
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-xjs/lib/geom/line.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index eec4f6d9..df65ee86 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -537,6 +537,15 @@ exports.Line = Object.create(GeomObj, {
537 ctx.strokeStyle = c; 537 ctx.strokeStyle = c;
538 } 538 }
539 539
540 var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils;
541 viewUtils.pushViewportObj( world.getCanvas() );
542 var cop = viewUtils.getCenterOfProjection();
543 viewUtils.popViewportObj();
544 var xCtr = cop[0] + this._xOffset, yCtr = cop[1] - this._yOffset;
545 var xLeft = xCtr - 0.5*this.getWidth(), yTop = yCtr - 0.5*this.getHeight();
546 var xDist = cop[0] - xLeft, yDist = cop[1] - yTop;
547 var xOff = 0.5*world.getViewportWidth() - xDist, yOff = 0.5*world.getViewportHeight() - yDist;
548
540 // get the points 549 // get the points
541 var p0, p1; 550 var p0, p1;
542 if(this._slope === "vertical") { 551 if(this._slope === "vertical") {
@@ -554,8 +563,8 @@ exports.Line = Object.create(GeomObj, {
554 } 563 }
555 564
556 // draw the line 565 // draw the line
557 ctx.moveTo( p0[0], p0[1] ); 566 ctx.moveTo( p0[0]+xOff, p0[1]+yOff );
558 ctx.lineTo( p1[0], p1[1] ); 567 ctx.lineTo( p1[0]+xOff, p1[1]+yOff );
559 ctx.stroke(); 568 ctx.stroke();
560 } 569 }
561 } 570 }