diff options
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-x | js/lib/geom/line.js | 13 |
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 | } |