Moved peer connections to an optional pull model

This commit is contained in:
Mitchell McCaffrey
2020-12-11 13:24:39 +11:00
parent b40f78042f
commit 6a4c6b30ec
8 changed files with 246 additions and 182 deletions

View File

@@ -21,6 +21,7 @@ import KeyboardContext from "../../contexts/KeyboardContext";
function MapInteraction({
map,
mapState,
children,
controls,
selectedToolId,
@@ -32,12 +33,16 @@ function MapInteraction({
// Map loaded taking in to account different resolutions
const [mapLoaded, setMapLoaded] = useState(false);
useEffect(() => {
if (map === null) {
if (
!map ||
(map.type === "file" && !map.file && !map.resolutions) ||
mapState.mapId !== map.id
) {
setMapLoaded(false);
} else if (mapImageSourceStatus === "loaded") {
setMapLoaded(true);
}
}, [mapImageSourceStatus, map]);
}, [mapImageSourceStatus, map, mapState]);
const [stageWidth, setStageWidth] = useState(1);
const [stageHeight, setStageHeight] = useState(1);