Moved back to always showing controls and removed option to disable map change
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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: (
|
||||
<SelectMapButton
|
||||
@@ -79,10 +78,8 @@ function MapContols({
|
||||
currentMap={currentMap}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
if (!disabledControls.includes("drawing")) {
|
||||
sections.push({
|
||||
},
|
||||
{
|
||||
id: "drawing",
|
||||
component: tools.map((tool) => (
|
||||
<RadioIconButton
|
||||
@@ -95,8 +92,8 @@ function MapContols({
|
||||
{toolsById[tool].icon}
|
||||
</RadioIconButton>
|
||||
)),
|
||||
});
|
||||
sections.push({
|
||||
},
|
||||
{
|
||||
id: "history",
|
||||
component: (
|
||||
<>
|
||||
@@ -114,8 +111,8 @@ function MapContols({
|
||||
</IconButton>
|
||||
</>
|
||||
),
|
||||
});
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
let controls = null;
|
||||
if (sections.length === 1 && sections[0].id === "map") {
|
||||
|
||||
@@ -72,10 +72,10 @@ function MapSettings({
|
||||
<Label>
|
||||
<Checkbox
|
||||
checked={
|
||||
mapState !== null && mapState.editFlags.includes("drawings")
|
||||
mapState !== null && mapState.editFlags.includes("drawing")
|
||||
}
|
||||
disabled={mapState === null}
|
||||
onChange={(e) => handleFlagChange(e, "drawings")}
|
||||
onChange={(e) => handleFlagChange(e, "drawing")}
|
||||
/>
|
||||
Drawings
|
||||
</Label>
|
||||
@@ -89,16 +89,6 @@ function MapSettings({
|
||||
/>
|
||||
Tokens
|
||||
</Label>
|
||||
<Label>
|
||||
<Checkbox
|
||||
checked={
|
||||
mapState !== null && mapState.editFlags.includes("map")
|
||||
}
|
||||
disabled={mapState === null}
|
||||
onChange={(e) => handleFlagChange(e, "map")}
|
||||
/>
|
||||
Map
|
||||
</Label>
|
||||
</Flex>
|
||||
</Box>
|
||||
<Box my={2} sx={{ flexGrow: 1 }}>
|
||||
|
||||
Reference in New Issue
Block a user