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

Layer popup partly invisible on map click #39

Open
nesnoj opened this issue May 22, 2019 · 0 comments
Open

Layer popup partly invisible on map click #39

nesnoj opened this issue May 22, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@nesnoj
Copy link
Member

nesnoj commented May 22, 2019

When a layer entity is clicked, the popup is shown but partly hidden which is caused by wrong centering (clicked point is centered).
In 3418146 I adjusted the centered point by using the viewport/map size. This works for the current max. size of the popups but is not responsive and may doesn't work as desired for larger popups in the future.

I have a responsive solution which considers the popup size (found here):

var px = layer._map.project(layer._popup._latlng); // find the pixel location on the map where the popup anchor is
px.y -= layer._popup._container.clientHeight/2; // find the height of the popup container, divide by 2, subtract from the Y axis of marker location
layer._map.panTo(layer._map.unproject(px), {animate: true, duration: 1}); // pan to new center

But: The loading of popup content is delayed by 250ms so the panning needs to be delayed as well to obtain the correct popup size. The result looks quite "laggy" due to the delay as well as due to the initial default panning which is interrupted by this custom panning. Hence I didn't use this solution.

The solution in 3418146 is ok for now but may be replaced by a responsive approach later.

@nesnoj nesnoj added the bug Something isn't working label May 22, 2019
@nesnoj nesnoj added this to the nice_to_have milestone May 22, 2019
@nesnoj nesnoj assigned 4lm and nesnoj May 22, 2019
4lm pushed a commit that referenced this issue May 23, 2019
@nesnoj nesnoj added enhancement New feature or request and removed bug Something isn't working labels Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants