Fix drawing erase while on controls and brush type switch bug
This commit is contained in:
parent
aac11790e2
commit
6e48d7d4e2
@ -155,19 +155,19 @@ function MapDrawing({
|
||||
if (event.touches && event.touches.length !== 0) {
|
||||
return;
|
||||
}
|
||||
setIsDrawing(false);
|
||||
if (selectedTool === "brush") {
|
||||
if (selectedTool === "brush" && drawingShape) {
|
||||
if (drawingShape.data.points.length > 1) {
|
||||
onShapeAdd(drawingShape);
|
||||
}
|
||||
} else if (selectedTool === "shape") {
|
||||
} else if (selectedTool === "shape" && drawingShape) {
|
||||
onShapeAdd(drawingShape);
|
||||
}
|
||||
|
||||
setDrawingShape(null);
|
||||
if (selectedTool === "erase" && hoveredShapeRef.current) {
|
||||
if (selectedTool === "erase" && hoveredShapeRef.current && isDrawing) {
|
||||
onShapeRemove(hoveredShapeRef.current.id);
|
||||
}
|
||||
setIsDrawing(false);
|
||||
setDrawingShape(null);
|
||||
}
|
||||
|
||||
// Add listeners for draw events on map to allow drawing past the bounds
|
||||
|
@ -122,7 +122,6 @@ function MapFog({
|
||||
if (event.touches && event.touches.length !== 0) {
|
||||
return;
|
||||
}
|
||||
setIsDrawing(false);
|
||||
if (isEditing && toolSettings.type === "add" && drawingShape) {
|
||||
if (drawingShape.data.points.length > 1) {
|
||||
const shape = {
|
||||
@ -134,10 +133,15 @@ function MapFog({
|
||||
}
|
||||
}
|
||||
|
||||
setDrawingShape(null);
|
||||
if (toolSettings.type === "remove" && hoveredShapeRef.current) {
|
||||
if (
|
||||
toolSettings.type === "remove" &&
|
||||
hoveredShapeRef.current &&
|
||||
isDrawing
|
||||
) {
|
||||
onShapeRemove(hoveredShapeRef.current.id);
|
||||
}
|
||||
setDrawingShape(null);
|
||||
setIsDrawing(false);
|
||||
}
|
||||
|
||||
// Add listeners for draw events on map to allow drawing past the bounds
|
||||
|
Loading…
Reference in New Issue
Block a user