Added a reset for the map when the source is changed

This commit is contained in:
Mitchell McCaffrey 2020-03-26 15:43:52 +11:00
parent 974e39a2e6
commit c1d4e09cb3

View File

@ -72,6 +72,12 @@ function Map({
);
}
// Reset map transform when map changes
useEffect(() => {
setMapTranslate({ x: 0, y: 0 });
setMapScale(1);
}, [mapSource]);
const mapRef = useRef(null);
const rows = mapData && mapData.rows;
const tokenSizePercent = (1 / rows) * 100;