Fix bug with map transform resetting when a new resolution is loaded

This commit is contained in:
Mitchell McCaffrey 2020-07-17 17:06:40 +10:00
parent 5ba4817398
commit 5e6f3537b4

View File

@ -76,7 +76,7 @@ function MapInteraction({
// Reset transform when map changes
useEffect(() => {
const layer = mapLayerRef.current;
if (map && layer) {
if (map && layer && !mapLoaded) {
const mapHeight = stageWidthRef.current * (map.height / map.width);
const newTranslate = {
x: 0,
@ -89,7 +89,7 @@ function MapInteraction({
setStageScale(1);
}
}, [map]);
}, [map, mapLoaded]);
const pinchPreviousDistanceRef = useRef();
const pinchPreviousOriginRef = useRef();