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
add source to movestart, move, moveend, zoomstart, zoom and zoomend events #6929
base: main
Are you sure you want to change the base?
Conversation
As I said before, I'm not convinced by this approach. Something in the back of my brain tells me that there's gonna be some edge case where an event handler calls another event handler and things go inconsistent. This would be better with some unit tests, specifically in the parts where we test user interaction via touch and mouse drag, e.g. #2934 (comment). The code in the PR looks good, but unfortunately doesn't give me any assurance that it'll work. |
Wait before merging this pull request, I want to refactor these changes, instead of adding a parameter to a lot of methods, I'm going to use the existing parameter options. This way all the plugins which redefine methods of Leaflet will continue to work. |
Any update on this ? |
I've merged it on my fork, and it works fine. |
Any update? Would be nice to have this feature. |
Any updates on this ? Would be great ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just random thoughts:
@@ -22,12 +22,12 @@ import * as DomUtil from '../dom/DomUtil'; | |||
|
|||
export var PosAnimation = Evented.extend({ | |||
|
|||
// @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number) | |||
// @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number, source?: String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No mention in description
// Sets the view of the map (geographical center and zoom) with the given | ||
// animation options. | ||
setView: function (center, zoom, options) { | ||
setView: function (center, zoom, options, source) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps better include into existing options
// Sets the zoom of the map. | ||
setZoom: function (zoom, options) { | ||
setZoom: function (zoom, options, source) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, here and in a many other places
And all this should be covered by tests.. |
Any update on this? Very interested and happy to investigate, wasn't sure if this is just being disregarded now in favour of other methods of tracking event source? |
It would be very useful to know when the map is moved or zoomed due to user interaction.
So here‘s a pull request which adds a 'source' property to movestart, move, moveend, zoomstart, zoom, and zoomend events.
The source is either
user(.[a-z]+)?
orimperative(.[a-z]+)?
, depending on how was triggered the event.This pull request is mostly based on this one #5247 which is three years old and was never merged for some unknown reason.