-
-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] Emit move event even when source is custom #1231 #1232
Conversation
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.
As an aside, that whole area of code (all the if statements), just makes me ponder why it wasn't written to just emit an event with a source and cut out loads of lines, but it would probably break usage to change all of that now. So I don't think I have a problem with this, it shouldn't affect anything else really.
I also tried out removing the condition that source must be custom, so that the event would be emitted for all event sources not covered before, whenever zoom or center changes. That broke the flutter_map test, so I removed it. |
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.
LGTM as a fix, but maybe needs to be looked at in the long-term future. However, the analyser needs to be appeased before I can merge :)
Looks like some unrelated changes have caused the checks to fail, so I will have to explore this in more detail. I will override the checks this time, as this code seems to be OK :) @ibrierley, you happy for this to be merged? |
I fixed the thing found by dart analyze in the example, so let's see how the pipeline likes this ;-) |
Thanks, that seems to have fixed it. Will merge now :) Many thanks for your contribution! |
Thank you @ibrierley and @JaffaKetchup :) |
As outlined in #1231, and discussed in Discord on 2022-05-11, certain zoom changes do not cause a move event to be emitted. This appears to be a bug, as probably everything changing the bounds should cause such an event. I am using flutter_map together with the flutter_map_marker_cluster plugin which e.g. zooms in if you tap on a cluster and thus changes the bounds, and I need to be able to react to that.
Therefore, I propose the following change to MapState._handleMoveEmit():
If source is custom, and targetZoom or targetCenter are different than before, a move event is emitted.
Thank you for your time and for flutter_map in general 😃