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

Methods for zooming in and out #27

Merged
merged 4 commits into from
Jun 6, 2020

Conversation

chucker
Copy link
Contributor

@chucker chucker commented May 19, 2020

These basically replicate the behavior of the built-in zoom control.

Copy link
Owner

@Mehigh17 Mehigh17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a nice idea, could you please add some examples in the Samples project.

const map = maps[mapId];

if (map.getZoom() > map.getMinZoom()) {
map.zoomOut(map.options.zoomDelta * (e.shiftKey ? 3 : 1));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be probably better if these hard coded values would be configurable by the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we should probably expose the ZoomDelta property somewhere (although I'm not sure it belongs in Map itself: that class runs risk of getting a lot of properties over time — do we want a MapSettings or MapOptions class?).

As for the 3, Leaflet hardcodes that behavior. Of course, that doesn't mean we need to do the same. What do we call this? HighSpeedZoomDelta, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want a MapSettings or MapOptions class?

I've moved that discussion to a separate issue #31.

If it's fine by you, I would just add ZoomDelta and ZoomDelta_Faster properties for now. The former would map directly to Leaflet's map.options.zoomDelta, but the latter would only have an effect if you run this PR's custom methods, since Leaflet itself hardcodes it to 3.

@Mehigh17 Mehigh17 added the enhancement Concerns changes that improve or upgrade the existing code base. label May 23, 2020
@chucker
Copy link
Contributor Author

chucker commented May 26, 2020

I'll have a look at your comments hopefully next week.

@chucker
Copy link
Contributor Author

chucker commented May 27, 2020

Sounds like a nice idea, could you please add some examples in the Samples project.

I've added a sample page.

Your concern on hard-coded values still needs to be addressed.

@Mehigh17
Copy link
Owner

Mehigh17 commented Jun 6, 2020

It's good to go during the alpha, thanks for the contribution.

@Mehigh17 Mehigh17 merged commit e086d20 into Mehigh17:master Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Concerns changes that improve or upgrade the existing code base.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants