Fixed 2 bugs with map loading and sending

When a map was sent the receiver didn't save the resolutions tihs meant that if the original map owner left or wasn't the party leader the map would be blank when new users joined. Also if a map sender left when sending a map and rejoined their version of the map would be overriden by a corrupted version.
This commit is contained in:
Mitchell McCaffrey
2020-08-28 17:06:13 +10:00
parent 7f7471b1e9
commit b4e52ebb23
3 changed files with 51 additions and 29 deletions

View File

@@ -31,13 +31,15 @@ function MapInteraction({
disabledControls,
}) {
let mapSourceMap = map;
if (map && map.type === "file") {
if (
map.resolutions &&
map.quality !== "original" &&
map.resolutions[map.quality]
) {
if (map && map.type === "file" && map.resolutions) {
// Set to the quality if available
if (map.quality !== "original" && map.resolutions[map.quality]) {
mapSourceMap = map.resolutions[map.quality];
} else if (!map.file) {
// If no file fallback to the highest resolution
for (let resolution in map.resolutions) {
mapSourceMap = map.resolutions[resolution];
}
}
}