diff --git a/src/components/map/MapFog.js b/src/components/map/MapFog.js index fa12e6c..8ae205e 100644 --- a/src/components/map/MapFog.js +++ b/src/components/map/MapFog.js @@ -284,6 +284,7 @@ function MapFog({ function handlePointerMove() { if ( + editable && active && (toolSettings.type === "polygon" || toolSettings.type === "rectangle") ) { @@ -572,7 +573,7 @@ function MapFog({ if (editable) { const visibleShapes = shapes.filter(shapeVisible); - setFogShapeBoundingBoxes(getFogShapesBoundingBoxes(visibleShapes)); + setFogShapeBoundingBoxes(getFogShapesBoundingBoxes(visibleShapes, 5)); setFogShapes(visibleShapes); } else { setFogShapes(mergeFogShapes(shapes)); diff --git a/src/helpers/drawing.js b/src/helpers/drawing.js index 9f3f595..4491d61 100644 --- a/src/helpers/drawing.js +++ b/src/helpers/drawing.js @@ -260,11 +260,15 @@ export function mergeFogShapes(shapes, ignoreHidden = true) { /** * @param {Fog[]} shapes + * @param {boolean} maxPoints Max amount of points per shape to get bounds for * @returns {Vector2.BoundingBox[]} */ -export function getFogShapesBoundingBoxes(shapes) { +export function getFogShapesBoundingBoxes(shapes, maxPoints = 0) { let boxes = []; for (let shape of shapes) { + if (maxPoints > 0 && shape.data.points.length > maxPoints) { + continue; + } boxes.push(Vector2.getBoundingBox(shape.data.points)); } return boxes;