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( const simplified = simplifyPoints(
[...prevPoints, brushPosition], [...prevPoints, brushPosition],
gridCellNormalizedSize, 1 / 1000 / stageScale
stageScale
); );
return { return {
...prevShape, ...prevShape,

View File

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

View File

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