Added note edit flags
This commit is contained in:
parent
8873e59205
commit
6fedcc171d
@ -40,6 +40,7 @@ function Map({
|
||||
allowMapDrawing,
|
||||
allowFogDrawing,
|
||||
allowMapChange,
|
||||
allowNoteEditing,
|
||||
disabledTokens,
|
||||
session,
|
||||
}) {
|
||||
@ -138,7 +139,6 @@ function Map({
|
||||
disabledControls.push("pan");
|
||||
disabledControls.push("measure");
|
||||
disabledControls.push("pointer");
|
||||
disabledControls.push("note");
|
||||
}
|
||||
if (!allowFogDrawing) {
|
||||
disabledControls.push("fog");
|
||||
@ -146,6 +146,9 @@ function Map({
|
||||
if (!allowMapChange) {
|
||||
disabledControls.push("map");
|
||||
}
|
||||
if (!allowNoteEditing) {
|
||||
disabledControls.push("note");
|
||||
}
|
||||
|
||||
const disabledSettings = { fog: [], drawing: [] };
|
||||
if (mapShapes.length === 0) {
|
||||
@ -399,7 +402,10 @@ function Map({
|
||||
: []
|
||||
}
|
||||
onNoteMenuOpen={handleNoteMenuOpen}
|
||||
draggable={selectedToolId === "note" || selectedToolId === "pan"}
|
||||
draggable={
|
||||
allowNoteEditing &&
|
||||
(selectedToolId === "note" || selectedToolId === "pan")
|
||||
}
|
||||
onNoteDragStart={(e, noteId) =>
|
||||
setNoteDraggingOptions({ dragging: true, noteId, noteGroup: e.target })
|
||||
}
|
||||
|
@ -233,6 +233,16 @@ function MapSettings({
|
||||
/>
|
||||
Tokens
|
||||
</Label>
|
||||
<Label>
|
||||
<Checkbox
|
||||
checked={
|
||||
!mapStateEmpty && mapState.editFlags.includes("notes")
|
||||
}
|
||||
disabled={mapStateEmpty}
|
||||
onChange={(e) => handleFlagChange(e, "notes")}
|
||||
/>
|
||||
Notes
|
||||
</Label>
|
||||
</Flex>
|
||||
</Box>
|
||||
</>
|
||||
|
@ -19,7 +19,7 @@ const defaultMapState = {
|
||||
fogDrawActionIndex: -1,
|
||||
fogDrawActions: [],
|
||||
// Flags to determine what other people can edit
|
||||
editFlags: ["drawing", "tokens"],
|
||||
editFlags: ["drawing", "tokens", "notes"],
|
||||
notes: {},
|
||||
};
|
||||
|
||||
|
@ -277,6 +277,7 @@ function loadVersions(db) {
|
||||
.toCollection()
|
||||
.modify((state) => {
|
||||
state.notes = {};
|
||||
state.editFlags = [...state.editFlags, "notes"];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -463,6 +463,12 @@ function NetworkedMapAndTokens({ session }) {
|
||||
currentMapState !== null &&
|
||||
(currentMapState.editFlags.includes("fog") || currentMap.owner === userId);
|
||||
|
||||
const canEditNotes =
|
||||
currentMap !== null &&
|
||||
currentMapState !== null &&
|
||||
(currentMapState.editFlags.includes("notes") ||
|
||||
currentMap.owner === userId);
|
||||
|
||||
const disabledMapTokens = {};
|
||||
// If we have a map and state and have the token permission disabled
|
||||
// and are not the map owner
|
||||
@ -499,6 +505,7 @@ function NetworkedMapAndTokens({ session }) {
|
||||
allowMapDrawing={canEditMapDrawing}
|
||||
allowFogDrawing={canEditFogDrawing}
|
||||
allowMapChange={canChangeMap}
|
||||
allowNoteEditing={canEditNotes}
|
||||
disabledTokens={disabledMapTokens}
|
||||
session={session}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user