Fix storm cards not flying to the storm: stop waiting on the one-shot map 'load' event
Publish Container / publish (push) Successful in 2m34s
Publish Container / publish (push) Successful in 2m34s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fda8dca435
commit
a185d10e1c
1 file changed
+3
-1
+3
-1
@@ -174,7 +174,9 @@ async function flyToHurricane(storm) {
|
|||||||
|
|
||||||
const map = mapsOverview.map;
|
const map = mapsOverview.map;
|
||||||
if (!map) return;
|
if (!map) return;
|
||||||
if (!map.loaded()) await new Promise(resolve => map.once('load', resolve));
|
// 'load' fires only once per map, so waiting on it hangs forever whenever tiles are mid-load;
|
||||||
|
// flyTo works regardless, so just make sure the canvas has its real size first.
|
||||||
|
map.resize();
|
||||||
|
|
||||||
map.flyTo({ center: [lon, lat], zoom: 4, duration: 900 });
|
map.flyTo({ center: [lon, lat], zoom: 4, duration: 900 });
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user