Commit 96c14d5b authored by Christian Winter's avatar Christian Winter

measure tool now shows distance on hypotenuse

parent 783c755b
Pipeline #4767212 passed with stage
in 58 seconds
......@@ -911,6 +911,18 @@
pos.x = (size.x > 0) ? pos.x + offset.x : pos.x - offset.x;
this.currentContext.fillText(+((size.y / GridManager.grid.height).toFixed(2)), pos.x, pos.y);
// xy
pos = p1.addVector(p2).divide(2);
let off = LineManipulator.rotatePositionByAngle(size.normalized().multiply(30), Vector2.zero, -90);
off = off.divide(Camera.zoom);
off = (size.y > 0) ? off.flipped() : off;
pos = (size.x > 0) ? pos.addVector(off) : pos.subtractVector(off);
pos = Camera.canvasSpaceToScreenSpace(pos);
let x = size.x / GridManager.grid.width;
let y = size.y / GridManager.grid.height;
this.currentContext.fillText(+(Math.sqrt(x*x + y*y).toFixed(2)), pos.x, pos.y);
// angle
pos = p1.addVector(size.normalized().multiply(33 / Camera.zoom));
pos = LineManipulator.rotatePositionByAngle(pos, p1, 180);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment