Move drawing simplify away from grid dependent scaling
This commit is contained in:
parent
f5ccbe8f8f
commit
948be7cac2
@ -119,8 +119,7 @@ function MapDrawing({
|
||||
}
|
||||
const simplified = simplifyPoints(
|
||||
[...prevPoints, brushPosition],
|
||||
gridCellNormalizedSize,
|
||||
stageScale
|
||||
1 / 1000 / stageScale
|
||||
);
|
||||
return {
|
||||
...prevShape,
|
||||
|
@ -176,8 +176,7 @@ function MapFog({
|
||||
}
|
||||
const simplified = simplifyPoints(
|
||||
[...prevPoints, brushPosition],
|
||||
gridCellNormalizedSize,
|
||||
stageScale / 4
|
||||
1 / 1000 / stageScale
|
||||
);
|
||||
return {
|
||||
...prevShape,
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user