diff --git a/src/components/map/Map.js b/src/components/map/Map.js index 502c694..d8d683f 100644 --- a/src/components/map/Map.js +++ b/src/components/map/Map.js @@ -29,7 +29,8 @@ function Map({ onFogDraw, onMapUndo, onMapRedo, - allowDrawing, + allowMapDrawing, + allowFogDrawing, allowTokenChange, allowMapChange, }) { @@ -139,7 +140,7 @@ function Map({ if (!allowMapChange) { disabledControls.push("map"); } - if (!allowDrawing) { + if (!allowMapDrawing) { disabledControls.push("drawing"); } if (!map) { @@ -152,6 +153,9 @@ function Map({ if (!mapState || mapState.mapDrawActionIndex < 0) { disabledControls.push("undo"); } + if (!allowFogDrawing) { + disabledControls.push("fog"); + } if ( !mapState || mapState.mapDrawActionIndex === mapState.mapDrawActions.length - 1 @@ -266,7 +270,7 @@ function Map({ map={map} aspectRatio={aspectRatio} isEnabled={selectedToolId === "pan"} - controls={(allowMapChange || allowDrawing) && mapControls} + controls={(allowMapChange || allowMapDrawing) && mapControls} > {map && mapImage} {map && mapDrawing} diff --git a/src/components/map/MapControls.js b/src/components/map/MapControls.js index 4d7d311..8491435 100644 --- a/src/components/map/MapControls.js +++ b/src/components/map/MapControls.js @@ -202,6 +202,13 @@ function MapContols({ } } + // Move back to pan tool if selected tool becomes disabled + useEffect(() => { + if (disabledControls.includes(selectedToolId)) { + onSelectedToolChange("pan"); + } + }, [disabledControls]); + // Stop map drawing from happening when selecting controls // Not using react events as they seem to trigger after dom events useEffect(() => { diff --git a/src/components/map/MapSettings.js b/src/components/map/MapSettings.js index 8c6b012..f69dd9b 100644 --- a/src/components/map/MapSettings.js +++ b/src/components/map/MapSettings.js @@ -59,6 +59,16 @@ function MapSettings({ +