Update maps and tokens to have thumbnails and removed loading of all files on load

This commit is contained in:
Mitchell McCaffrey
2021-02-08 16:53:56 +11:00
parent b9993e1a0b
commit 24e64f9d32
16 changed files with 418 additions and 137 deletions
+4 -4
View File
@@ -208,7 +208,7 @@ function NetworkedMapAndTokens({ session }) {
}
}, [currentMap, debouncedMapState, userId, database, updateMapState]);
function handleMapChange(newMap, newMapState) {
async function handleMapChange(newMap, newMapState) {
// Clear map before sending new one
setCurrentMap(null);
session.socket?.emit("map", null);
@@ -217,17 +217,16 @@ function NetworkedMapAndTokens({ session }) {
setCurrentMap(newMap);
if (newMap && newMap.type === "file") {
const { file, resolutions, ...rest } = newMap;
const { file, resolutions, thumbnail, ...rest } = newMap;
session.socket?.emit("map", rest);
} else {
session.socket?.emit("map", newMap);
}
if (!newMap || !newMapState) {
return;
}
loadAssetManifestFromMap(newMap, newMapState);
await loadAssetManifestFromMap(newMap, newMapState);
}
function handleMapStateChange(newMapState) {
@@ -406,6 +405,7 @@ function NetworkedMapAndTokens({ session }) {
...map,
resolutions: undefined,
file: undefined,
thumbnail: undefined,
// Remove last modified so if there is an error
// during the map request the cache is invalid
lastModified: 0,