Add more simplification to fog shapes
This commit is contained in:
parent
8148e5c52c
commit
84d6db3ce7
@ -170,11 +170,16 @@ function MapFog({
|
|||||||
) {
|
) {
|
||||||
return prevShape;
|
return prevShape;
|
||||||
}
|
}
|
||||||
|
const simplified = simplifyPoints(
|
||||||
|
[...prevPoints, brushPosition],
|
||||||
|
gridCellNormalizedSize,
|
||||||
|
stageScale / 4
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
...prevShape,
|
...prevShape,
|
||||||
data: {
|
data: {
|
||||||
...prevShape.data,
|
...prevShape.data,
|
||||||
points: [...prevPoints, brushPosition],
|
points: simplified,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -205,27 +210,14 @@ function MapFog({
|
|||||||
drawingShape
|
drawingShape
|
||||||
) {
|
) {
|
||||||
const cut = toolSettings.useFogCut;
|
const cut = toolSettings.useFogCut;
|
||||||
|
let drawingShapes = [drawingShape];
|
||||||
let simplifiedShape = {
|
|
||||||
...drawingShape,
|
|
||||||
data: {
|
|
||||||
...drawingShape.data,
|
|
||||||
points: simplifyPoints(
|
|
||||||
drawingShape.data.points,
|
|
||||||
gridCellNormalizedSize,
|
|
||||||
Math.max(stageScale, 1)
|
|
||||||
),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let drawingShapes = [simplifiedShape];
|
|
||||||
if (!toolSettings.multilayer) {
|
if (!toolSettings.multilayer) {
|
||||||
const shapesToSubtract = shapes.filter((shape) =>
|
const shapesToSubtract = shapes.filter((shape) =>
|
||||||
cut ? !shape.visible : shape.visible
|
cut ? !shape.visible : shape.visible
|
||||||
);
|
);
|
||||||
const subtractAction = new SubtractShapeAction(shapesToSubtract);
|
const subtractAction = new SubtractShapeAction(shapesToSubtract);
|
||||||
const state = subtractAction.execute({
|
const state = subtractAction.execute({
|
||||||
[simplifiedShape.id]: simplifiedShape,
|
[drawingShape.id]: drawingShape,
|
||||||
});
|
});
|
||||||
drawingShapes = Object.values(state)
|
drawingShapes = Object.values(state)
|
||||||
.filter((shape) => shape.data.points.length > 2)
|
.filter((shape) => shape.data.points.length > 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user