-
Notifications
You must be signed in to change notification settings - Fork 24
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
Prevent map from rotating when user just wants to zoom #48
base: master
Are you sure you want to change the base?
Conversation
@mauriciabad let me know about 84af42b |
Awesome! Thanks for taking the time to polish it ❤️. |
Okay, now it starts rotating at the bearing that the threshold has been passed. So it is way smoother. Sometimes there can be a glitch where it rotates instantly, but it's very rare, and I can't figure out what gesture causes it. Besides that, it works fine. I have no idea about how to write tests for that. |
@mauriciabad Yep, mostly I was looking for a code structure with less chained/nested if conditions (math itself is already quite complex within this repo..) Let me know: 58d5b52 |
I can't code anymore because I can't run the code... I'm doing In the previous commits, I managed do run it but I forgot what I did... |
@mauriciabad clone this repo under a local xampp/lamp server (ie. http://localhost:80/leaflet-elevation/test), and then run In the worst case scenario, make sure you have disabled browser cache.. 👋 Raruto |
@mauriciabad is this ok? (I'm not going to test it for you...) |
The problem
The current implementation, when you zoom in, the map also rotates slightly. This is very annoying and causes a lot of unnecessary lag.
If you compare it with other maps like Google maps or MapBox, they detect if you are trying to zoom or rotate, and only do one of them. This is way more confortable.
Introduced changes
I just made a quick fix for my app. It is still annoying because when the threshold is passed, it instantly rotates from the original position. But I still prefer this than always rotating.
Next steps
It introduces a new option
minBearingThreshold
of typenumber | undefined
, the.d.ts
files should be updated. I can do it after this is merged.A new release should be published as well.
Discussion
If the feature is not good enough for your standards, feel free to tweak it, or indicate me what to change. For me, this is "good enough" for the amount of time I'm willing to spend (the UX of the leaflet will still be horrible anyways XD).