-
Notifications
You must be signed in to change notification settings - Fork 149
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 initial solution to moving target problem #1245
Conversation
} | ||
|
||
internal struct CameraOptionsComponent<T>: CameraOptionsComponentProtocol { | ||
internal let keyPath: WritableKeyPath<CameraOptions, T?> |
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.
does it have to be a key path to an optional property of CameraOptions
? I see that CameraOptions has everything as Optional now, but if in the future we decide to add new property that is non-optional then this will not work for those properties.
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.
It wouldn't have to be. Doing it this way allows value
(on the next line) to be non-optional.
The *Options
naming pattern in GL Native typically indicates a type where all of its fields are optional. You pass instances to a setter and non-nil fields are updated and any nil fields are not modified. Given that, it's probably unlikely that we'll add non-optional fields to CameraOptions
in the future.
Sources/MapboxMaps/Viewport/Transitions/Default/DefaultViewportTransition.swift
Outdated
Show resolved
Hide resolved
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.
Nice architecture!
This PR updates the DefaultViewportTransition to animate using SimpleCameraAnimator and update the animator's target camera dynamically during the animation. This approach results in arriving at exactly the right location at the end of the transition.
Before.-.Compressed.mp4
After.-.Compressed.mp4
The high-to-low and low-to-high animation spec providers are not yet tested. Those tests will be added in a subsequent PR.
Pull request checklist:
## main
heading near the top).