You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Let MGLMapViewDelegate cancel region changes #2457
-[MGLMapViewDelegate mapView:regionWillChangeAnimated:] should return a Boolean, so that delegates can cancel impending viewport changes by return NO. If the viewport change was initiated programmatically, perhaps the return value should be ignored, but it should at least be honored for viewport changes initiated by gesture recognizers.
Instead of overloading -mapView:regionWillChangeAnimated:, I think it would be better to have a -mapView:shouldChangeToCamera:animated: that takes an additional MGLMapCamera object, so that the implementer can make an informed decision about the animation that will take place. Or, following NSAnimationDelegate in AppKit, we could pass in an MGLMapAnimation object that encapsulates all the known information about an animation: its start and endpoints as well as the action that triggered the animation.
On iOS, the map view would ideally allow the user to pan to a disallowed region but quickly snap back to within the allowed region as soon as the gesture is complete. So if -mapView:shouldChangeToCamera:animated: returns NO, the transition should continue but a bounce-back transition should be queued up, to be run immediately after the disallowed change.
Hey, I'm new here. As a possible variation/update to this proposal, UIScrollView has a delegate method called: - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint *)targetContentOffset
which lets the implementor provide a replacement offset to complete the animation with. What if the implementor can provide an alternate MGLCamera to animate to?
For starters, I’ve implemented the simplest possible API in #5584.
The camera-redirecting API proposed in #2457 (comment) would be more complex both to implement and use effectively, but I’m not opposed to that design if we can make it work. The current mbgl transform API is the limiting factor right now.
Activity
1ec5 commentedon Nov 20, 2015
Instead of overloading
-mapView:regionWillChangeAnimated:, I think it would be better to have a-mapView:shouldChangeToCamera:animated:that takes an additional MGLMapCamera object, so that the implementer can make an informed decision about the animation that will take place. Or, following NSAnimationDelegate in AppKit, we could pass in an MGLMapAnimation object that encapsulates all the known information about an animation: its start and endpoints as well as the action that triggered the animation.1ec5 commentedon Nov 20, 2015
#3090 would serve as a model for this method.
1ec5 commentedon Dec 21, 2015
On iOS, the map view would ideally allow the user to pan to a disallowed region but quickly snap back to within the allowed region as soon as the gesture is complete. So if
-mapView:shouldChangeToCamera:animated:returnsNO, the transition should continue but a bounce-back transition should be queued up, to be run immediately after the disallowed change.Zakay commentedon Feb 29, 2016
+1 This is a great addition!
dsmitchell commentedon May 27, 2016
Hey, I'm new here. As a possible variation/update to this proposal, UIScrollView has a delegate method called: - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint *)targetContentOffset
which lets the implementor provide a replacement offset to complete the animation with. What if the implementor can provide an alternate MGLCamera to animate to?
1ec5 commentedon Jul 5, 2016
For starters, I’ve implemented the simplest possible API in #5584.
The camera-redirecting API proposed in #2457 (comment) would be more complex both to implement and use effectively, but I’m not opposed to that design if we can make it work. The current mbgl transform API is the limiting factor right now.
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
[ios, macos] Added delegate method to restrict movement
Delegate method to restrict movement (#5584)