Added map fog permissions

This commit is contained in:
Mitchell McCaffrey
2020-04-29 21:12:57 +10:00
parent aeb33058bb
commit 4b9b06395d
4 changed files with 32 additions and 4 deletions

View File

@@ -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}