Merge branch 'master' into release/v1.7.0

This commit is contained in:
Mitchell McCaffrey 2021-01-23 15:50:05 +11:00
commit f05fe32e13
7 changed files with 24 additions and 23 deletions

View File

@ -28,8 +28,8 @@
<meta property="og:image" content="%PUBLIC_URL%/thumbnail.jpg" />
<meta name="twitter:card" content="summary_large_image" />
<!-- Fathom -->
<script src="https://cdn.usefathom.com/script.js" data-spa="auto" data-site="%REACT_APP_FATHOM_SITE_ID%" defer></script>
<!-- / Fathom -->
<script src="https://angelfish.owlbear.rodeo/script.js" data-spa="auto" data-site="VMSHBPKD" data-excluded-domains="localhost" defer></script>
<!-- / Fathom -->
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -113,7 +113,7 @@ function NoteMenu({
left={`${menuLeft}px`}
onModalContent={handleModalContent}
>
<Box sx={{ width: "156px" }} p={1}>
<Box sx={{ width: "156px", overflow: "hidden" }} p={1}>
<Flex
as="form"
onSubmit={(e) => {

View File

@ -59,15 +59,14 @@ function TokenMenu({
if (!tokenState) {
return;
}
const statuses = tokenState.statuses;
let newStatuses = [];
if (statuses.includes(status)) {
newStatuses = statuses.filter((s) => s !== status);
const statuses = new Set(tokenState.statuses.filter((s) => s));
if (statuses.has(status)) {
statuses.delete(status);
} else {
newStatuses = [...statuses, status];
statuses.add(status);
}
onTokenStateChange({
[tokenState.id]: { ...tokenState, statuses: newStatuses },
[tokenState.id]: { ...tokenState, statuses: [...statuses] },
});
}
@ -130,7 +129,7 @@ function TokenMenu({
left={`${menuLeft}px`}
onModalContent={handleModalContent}
>
<Box sx={{ width: "156px" }} p={1}>
<Box sx={{ width: "156px", overflow: "hidden" }} p={1}>
<Flex
as="form"
onSubmit={(e) => {

View File

@ -4,9 +4,11 @@ import { Circle, Group } from "react-konva";
import colors from "../../helpers/colors";
function TokenStatus({ tokenState, width, height }) {
// Ensure statuses is an array and filter empty values
const statuses = [...new Set((tokenState?.statuses || []).filter((s) => s))];
return (
<Group x={width} y={height} offsetX={width / 2} offsetY={height / 2}>
{tokenState.statuses.map((status, index) => (
{statuses.map((status, index) => (
<Circle
key={status}
width={width}

View File

@ -23,7 +23,7 @@ export function PlayerProvider({ session, children }) {
},
session,
"player_state",
100,
500,
false
);

View File

@ -26,7 +26,7 @@ function useNetworkedState(
initialState,
session,
eventName,
debounceRate = 100,
debounceRate = 500,
partialUpdates = true,
partialUpdatesKey = "id"
) {

View File

@ -45,7 +45,7 @@ function NetworkedMapAndTokens({ session }) {
null,
session,
"map_state",
100,
500,
true,
"mapId"
);
@ -53,7 +53,7 @@ function NetworkedMapAndTokens({ session }) {
null,
session,
"manifest",
100,
500,
false
);
@ -428,19 +428,19 @@ function NetworkedMapAndTokens({ session }) {
const canChangeMap = !isLoading;
const canEditMapDrawing =
currentMap !== null &&
currentMapState !== null &&
currentMap &&
currentMapState &&
(currentMapState.editFlags.includes("drawing") ||
currentMap.owner === userId);
const canEditFogDrawing =
currentMap !== null &&
currentMapState !== null &&
currentMap &&
currentMapState &&
(currentMapState.editFlags.includes("fog") || currentMap.owner === userId);
const canEditNotes =
currentMap !== null &&
currentMapState !== null &&
currentMap &&
currentMapState &&
(currentMapState.editFlags.includes("notes") ||
currentMap.owner === userId);
@ -448,8 +448,8 @@ function NetworkedMapAndTokens({ session }) {
// If we have a map and state and have the token permission disabled
// and are not the map owner
if (
currentMapState !== null &&
currentMap !== null &&
currentMapState &&
currentMap &&
!currentMapState.editFlags.includes("tokens") &&
currentMap.owner !== userId
) {