-
-
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
rotate about gesture center #1437
Conversation
I think this was fixed some time ago via #1081 ? |
The PR you mentioned was only to zoom into the center of the pinch gesture, not for rotation |
Not sure if there's some misunderstanding here....currently with a pinchzoom, it will rotate around the gesture center (just tested it again for my sanity)...maybe it's because you are using an old version ? |
could you check again with |
Sure, that will stop it, but then don't do that :D. Jk! Firstly, it would be good to know what problem you are getting, to set that to true (I'm not very familiar with the race issues). Secondly, there is some very similar code above it, which "looks" like it does something quite similar. I think it would be better here to either a) move them (or combine them both) into a separate function if they do very similar things, or b) if they don't, we should document what each is doing specifically, and why they are different. Just my initial thoughts. |
hahaha, okay, I will try to describe it in depth. |
ping @ibrierley |
I think my problem is the above when it comes to maintaining this, unless I (or someone else!) gets time to have a proper dig... Ultimately as is, it isn't clear from the code when someone stumbles upon these in a years time (and the above description isn't very succinct either), (also the whole gesture code needs a rethink, but thats for another day/year/century). As a minimum, I think there should be more clarity in the code, whether that's from documentation/comments within the code, I don't mind. |
Okay, I understand (somewhat). |
Personally I don't have any issue with the intention of the change, its purely in the clarity of code when it comes to maintenance. Things I would probably do if I was writing this (but this is just personal taste here, anyone else feel free to give thoughts)...
If you look lower down in the code at _getNewEventCenterZoomPosition for example, it may give an idea of what I mean. There's nothing major there, but it does give clarity to the intention of the whole code. |
@ibrierley This is a very small change, I'm fine with merging this without proper documentation. What's 6 more spaghetti in a bolognese :)? If you're still not convinced, let's try to get this merged for v4. (cc. @Zzerr0r, @mootw, @TesteurManiak) |
I guess I'm easy if others are fine! |
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
Currently, when rotating via pinch gesture, the map would rotate about the map center. The purpose of this PR is to change this behavior to rotate about the center of the gesture instead.
This has only been tested with a previous version of flutter_map, as it is quite the hassle to get a fork to work locally because you have to change all the imports (at least I didn't find another way) ,which I didn't want to do again for version 3.0.0. So please test before merging.
I didn't add an option for the behavior, as I think it is generally expected to work like this. I can add it though, if required.