Repository navigation
Refactor Transform - #3497
Refactor Transform#3497
Conversation
|
Hi @1ec5, |
|
Hi Larry, #2600 is definitely top of mind for me right now. I’m open to your ideas about where the insets should be implemented. The refactoring in this PR is needed generally, but I wanted to make it possible to eventually implement the inset functionality down in Do you think you could push what you have so far (even a gist with a high-level overview is fine), so we can hash out the details and avoid conflicts? |
|
Yes sure we can push our work. It is not working fine with all interactions impacted by the insets. We still have issues to deal with. As you suggested in your comment we also implement the inset functionality in Transform and TransformState. The base idea is to add the insets on center(x,y) point in easeTo method. To do so we must take into account the map's angle and pitch. Unfortunately we ended up with an issue with the pitch perspective. Finally we tried to detect the "pitching gesture" by adding an API to state to be aware of it and applied in TransformState the inset to the matrix only if we are pitching. On the other side, in Transform we applied the inset only if we are not in a "gesture in progress" state. Still not good : the pitch case is not ok. At this moment I cannot give you a clear vision on what should be done to fulfill the inset functionality but here are some leads we have in mind:
I prepare a pull-request with a "DO NOT MERGE" in the commit message if you want to have a look on what we tried so far. |
|
Wonderful! I followed up in #3523. For this PR, I’m going to finish cleaning |
|
This is looking great. 👍 💯 |
cb24a25 to
e9ebd40
Compare
Eliminated many redundant methods on Transform. Minimized usage of TransformState::x and TransformState::y. Added convenient constructors for AnimationOptions. When scaling, passing in view’s origin as the anchor no longer anchors the scaling operation at the view’s center. To specify no anchor, use NaN. Increased precision of worldSize(), now that it’s used much more heavily in transform methods.
All Transform methods that take a PrecisionPoint now assume a “flipped” origin at the upper-left corner of the view. Previously, some methods assumed an origin at the lower-left corner.
Cleaned up gesture recognizers, flipping the origins of anchor points only and always before calling mbgl methods. This exposed the fact that the cursor locking feature during drag-zoom/rotate/tilt was broken, so I fixed it to match MapKit behavior exactly and also account for modifier changes in mid-gesture.
Made anchor a CameraOption for easeTo().
Pushed much of easeTo() and flyTo() into startTransition() to avoid code duplication.
21a3b43 to
ff8b014
Compare
|
Fantastic! |
This PR cleans up
Transformconsiderably, making it easier to implement #2600 at this low level:CameraOptionsonly describes the destination viewpoint now.AnimationOptionsdescribes the transition to that destination viewpoint.Transform.TransformState::xandTransformState::y.AnimationOptions. When scaling, passing in view’s origin as the anchor no longer anchors the scaling operation at the view’s center. To specify no anchor, useNaNinstead of 0.setBearing()to assume an origin at the upper-left corner of the view rather than the lower-left corner.anchoroption toCameraOptionsthat pins a coordinate to a point within the view throughout a zoom, rotation, or tilt. This option is useful for ensuring that a pinch or rotation gesture is revolves around the gesture rather than the view’s center point. However, all the platform frontends currently use convenience methods for this purpose anyways./cc @tmpsantos @zugaldia