Added alternating diagonals map measurement

This commit is contained in:
Mitchell McCaffrey
2020-11-20 12:00:59 +11:00
parent c338af5557
commit 4c301604fc
4 changed files with 38 additions and 3 deletions

View File

@@ -77,9 +77,11 @@ function MapMeasure({ map, selectedToolSettings, active, gridSize }) {
brushPosition,
gridSize
);
// Round the grid positions to the nearest 0.1 to aviod floating point issues
const precision = { x: 0.1, y: 0.1 };
const length = Vector2.distance(
Vector2.divide(points[0], gridSize),
Vector2.divide(points[1], gridSize),
Vector2.roundTo(Vector2.divide(points[0], gridSize), precision),
Vector2.roundTo(Vector2.divide(points[1], gridSize), precision),
selectedToolSettings.type
);
setDrawingShapeData({