Move drawing simplify away from grid dependent scaling

This commit is contained in:
Mitchell McCaffrey 2021-06-06 09:39:07 +10:00
parent f5ccbe8f8f
commit 948be7cac2
3 changed files with 5 additions and 12 deletions

View File

@ -119,8 +119,7 @@ function MapDrawing({
}
const simplified = simplifyPoints(
[...prevPoints, brushPosition],
gridCellNormalizedSize,
stageScale
1 / 1000 / stageScale
);
return {
...prevShape,

View File

@ -176,8 +176,7 @@ function MapFog({
}
const simplified = simplifyPoints(
[...prevPoints, brushPosition],
gridCellNormalizedSize,
stageScale / 4
1 / 1000 / stageScale
);
return {
...prevShape,

View File

@ -192,18 +192,13 @@ export function getUpdatedShapeData(
}
}
const defaultSimplifySize = 1 / 100;
/**
* Simplify points to a grid size
* @param {Vector2[]} points
* @param {Vector2} gridCellSize
* @param {number} scale
* @param {number} tolerance
*/
export function simplifyPoints(points, gridCellSize, scale) {
return simplify(
points,
(Vector2.min(gridCellSize) * defaultSimplifySize) / scale
);
export function simplifyPoints(points, tolerance) {
return simplify(points, tolerance);
}
/**