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

fire a window resize after rendering features #4

Merged
merged 1 commit into from Oct 14, 2019

Conversation

@chris48s
Copy link
Contributor

chris48s commented Oct 13, 2019

This plugin is really useful, but I hit a very frustrating issue with it:

As it stands, when I use it to render a polygon column, only the last row will have its polygon inside the desired viewport. All the other rows end up with the map offset from the intended centre. This screen capture shows an example of this behaviour. I get the same behaviour in firefox and chrome.

GIFrecord_2019-10-13_154418

This issue doesn't reproduce when the geometry is a Point.

I tried various ways to resolve this (changed the rendering order, moved the map.fitBounds() inside a layer.add event or a map.addlayer event handler, declared a new layer var each time through the loop, etc). None fo those were effective. The one thing I found did work was spoofing a window resize event that doesn't actually change the window size after all the maps are rendered. This has the effect of redrawing all the maps which then centers them all correctly, as shown in this screen capture:

GIFrecord_2019-10-13_154629

This is a rather unsatisfying fix as it doesn't really address the underlying issue, but it does at least offer a workaround.

@simonw

This comment has been minimized.

Copy link
Owner

simonw commented Oct 14, 2019

I spotted this bug too, but I never got around to investigating it. This is great - thanks for figuring out what was going on.

@simonw simonw merged commit ed0f459 into simonw:master Oct 14, 2019
@simonw

This comment has been minimized.

Copy link
Owner

simonw commented Oct 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.