From 9cec97fee138aa7735cb7971d6d384d227424c4a Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Thu, 11 Feb 2016 21:47:31 -0800 Subject: [PATCH] fix dimension rendering --- web/app/sketcher/shapes/dim.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/app/sketcher/shapes/dim.js b/web/app/sketcher/shapes/dim.js index b575cd40..4b049a3b 100644 --- a/web/app/sketcher/shapes/dim.js +++ b/web/app/sketcher/shapes/dim.js @@ -62,14 +62,18 @@ TCAD.TWO.LinearDimension.prototype.drawImpl = function(ctx, scale, viewer) { ctx.lineTo(_bx, _by); - function drawRef(startA, a) { - var off2 = 1.2; - ctx.moveTo(startA.x, startA.y); - ctx.lineTo(a.x + _vx * off2, a.y + _vy * off2); + function drawRef(start, x, y) { + var vec = new TCAD.Vector(x - start.x, y - start.y); + vec._normalize(); + vec._multiply(7); + + ctx.moveTo(start.x, start.y ); + ctx.lineTo(x, y); + ctx.lineTo(x + vec.x, y + vec.y); } - drawRef(startA, a); - drawRef(startB, b); + drawRef(startA, _ax, _ay); + drawRef(startB, _bx, _by); ctx.closePath(); ctx.stroke();