diff --git a/src/components/map/Map.js b/src/components/map/Map.js
index d8d683f..c0a4907 100644
--- a/src/components/map/Map.js
+++ b/src/components/map/Map.js
@@ -32,7 +32,6 @@ function Map({
allowMapDrawing,
allowFogDrawing,
allowTokenChange,
- allowMapChange,
}) {
const mapSource = useDataSource(map, defaultMapSources);
@@ -137,15 +136,18 @@ function Map({
}, [mapState]);
const disabledControls = [];
- if (!allowMapChange) {
- disabledControls.push("map");
- }
if (!allowMapDrawing) {
- disabledControls.push("drawing");
+ disabledControls.push("brush");
+ disabledControls.push("shape");
+ disabledControls.push("erase");
+ }
+ // If no actions that can be undone
+ if (!allowFogDrawing && !allowMapDrawing) {
+ disabledControls.push("undo");
+ disabledControls.push("redo");
}
if (!map) {
disabledControls.push("pan");
- disabledControls.push("brush");
}
if (mapShapes.length === 0) {
disabledControls.push("erase");
@@ -270,7 +272,7 @@ function Map({
map={map}
aspectRatio={aspectRatio}
isEnabled={selectedToolId === "pan"}
- controls={(allowMapChange || allowMapDrawing) && mapControls}
+ controls={mapControls}
>
{map && mapImage}
{map && mapDrawing}
diff --git a/src/components/map/MapControls.js b/src/components/map/MapControls.js
index 8491435..2431054 100644
--- a/src/components/map/MapControls.js
+++ b/src/components/map/MapControls.js
@@ -68,9 +68,8 @@ function MapContols({
};
const tools = ["pan", "fog", "brush", "shape", "erase"];
- const sections = [];
- if (!disabledControls.includes("map")) {
- sections.push({
+ const sections = [
+ {
id: "map",
component: (
),
- });
- }
- if (!disabledControls.includes("drawing")) {
- sections.push({
+ },
+ {
id: "drawing",
component: tools.map((tool) => (
)),
- });
- sections.push({
+ },
+ {
id: "history",
component: (
<>
@@ -114,8 +111,8 @@ function MapContols({
>
),
- });
- }
+ },
+ ];
let controls = null;
if (sections.length === 1 && sections[0].id === "map") {
diff --git a/src/components/map/MapSettings.js b/src/components/map/MapSettings.js
index f69dd9b..230d327 100644
--- a/src/components/map/MapSettings.js
+++ b/src/components/map/MapSettings.js
@@ -72,10 +72,10 @@ function MapSettings({
@@ -89,16 +89,6 @@ function MapSettings({
/>
Tokens
-
diff --git a/src/modals/SelectMapModal.js b/src/modals/SelectMapModal.js
index 04a2c31..980edb8 100644
--- a/src/modals/SelectMapModal.js
+++ b/src/modals/SelectMapModal.js
@@ -24,7 +24,7 @@ const defaultMapState = {
fogDrawActionIndex: -1,
fogDrawActions: [],
// Flags to determine what other people can edit
- editFlags: ["map", "drawings", "tokens"],
+ editFlags: ["drawing", "tokens"],
};
const defaultMapProps = {
diff --git a/src/routes/Game.js b/src/routes/Game.js
index c16ef09..4691e19 100644
--- a/src/routes/Game.js
+++ b/src/routes/Game.js
@@ -44,17 +44,10 @@ function Game() {
const [map, setMap] = useState(null);
const [mapState, setMapState] = useState(null);
- // TODO: move into map, consider removing map lockdown
- const canChangeMap =
- map === null ||
- (map !== null &&
- mapState !== null &&
- (mapState.editFlags.includes("map") || map.owner === userId));
-
- const canEditMapDrawings =
+ const canEditMapDrawing =
map !== null &&
mapState !== null &&
- (mapState.editFlags.includes("drawings") || map.owner === userId);
+ (mapState.editFlags.includes("drawing") || map.owner === userId);
const canEditFogDrawing =
map !== null &&
@@ -422,17 +415,14 @@ function Game() {
onMapUndo={handleMapUndo}
onMapRedo={handleMapRedo}
onFogDraw={handleFogDraw}
- allowMapDrawing={canEditMapDrawings}
+ allowMapDrawing={canEditMapDrawing}
allowFogDrawing={canEditFogDrawing}
allowTokenChange={canEditTokens}
- allowMapChange={canChangeMap}
/>
- {canEditTokens && (
-
- )}
+
setPeerError(null)}>