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

Clicking on point should not re-zoom the map #31

Closed
cmtoomey opened this issue Jan 2, 2018 · 2 comments
Closed

Clicking on point should not re-zoom the map #31

cmtoomey opened this issue Jan 2, 2018 · 2 comments
Labels

Comments

@cmtoomey
Copy link

cmtoomey commented Jan 2, 2018

Currently, when a user clicks on a point, the map will snap to that point at the default zoom (or what is specified as a arg).

The map should not zoom out based on interaction with a point

zoomjupyter

@akacarlyann
Copy link
Collaborator

akacarlyann commented Jan 28, 2018

See line 90 in circle.html (91 in graduated_circle.html and 105 in clustered_circle.html for similar):

    // Fly to on click
    map.on('click', 'circle', function(e) {
        map.flyTo({
            center: e.features[0].geometry.coordinates,
            zoom: 10
        });
    });

Can zoom just be omitted in these places to address this issue? Or does there need to be some sort of dynamic lookup of current zoom level to prevent zoom change?

@ryanbaumann
Copy link
Contributor

@akacarlyann yes, agree that changing the zoom behavior change is the simple fix here.

One default option that I think is common is to zoom the map in +1 level when clicking on a point. That would mean:

    // Fly to on click
    map.on('click', 'circle', function(e) {
        map.flyTo({
            center: e.features[0].geometry.coordinates, //center viewport on clicked feature
            zoom: map.getZoom() + 1  //add 1 to current zoom level
        });
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants