Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 945: fix jumpy narrative map #950

Merged
merged 1 commit into from
Mar 14, 2020
Merged

Issue 945: fix jumpy narrative map #950

merged 1 commit into from
Mar 14, 2020

Conversation

mapmeld
Copy link
Contributor

@mapmeld mapmeld commented Mar 14, 2020

Fixes #945

On the current site, when you resize the map by resizing the browser, switching between full <=> grid layout, or switch slides in a narrative, maybeInvalidateMapSize sets a 1500ms timer to call map.invalidateSize() and fill in blank map space. This can clash with the narrative's goal to focus the map "viewport" to contain the data.

Proposed solution in narrative mode, map.invalidateSize() happens immediately when we arrive on a new slide. The Leaflet resize event listener will be called after the resize is completed, and this is when we fit viewport to the data.

In free (not-narrative?) mode, the only change is I halved the resize-browser to resize-map delay to 750ms. If you prefer it can be un-changed.

@jameshadfield jameshadfield temporarily deployed to auspice-narrative-pan-o8kcwk9d March 14, 2020 23:00 Inactive
@jameshadfield
Copy link
Member

Thanks @mapmeld -- tested and it fixes the issue with no apparent regressions. The map logic is complicated, so thanks for tracking down a fix here ⭐️

@jameshadfield jameshadfield merged commit 3d89b93 into nextstrain:master Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map pan is broken in narratives
2 participants