Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Let MGLMapViewDelegate cancel region changes #2457

Closed

Description

@1ec5

-[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.

/cc @friedbunny @incanus

Activity

  1. added
    iOS
    on Sep 29, 2015
  2. 1ec5 commented on Nov 20, 2015

    @1ec5
    ContributorAuthor

    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.

  3. 1ec5 commented on Nov 20, 2015

    @1ec5
    ContributorAuthor

    #3090 would serve as a model for this method.

  4. 1ec5 commented on Dec 21, 2015

    @1ec5
    ContributorAuthor

    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.

  5. Zakay commented on Feb 29, 2016

    @Zakay

    +1 This is a great addition!

  6. dsmitchell commented on May 27, 2016

    @dsmitchell

    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?

  7. 1ec5 commented on Jul 5, 2016

    @1ec5
    ContributorAuthor

    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.

  8. modified the milestone: ios-v3.3.1 on Jul 6, 2016
  9. added a commit that references this issue on Jul 10, 2016
    11253ec
  10. added a commit that references this issue on Jul 19, 2016
    ce3d847
  11. added a commit that references this issue on Oct 17, 2016
    31c7a15
  12. added a commit that references this issue on Dec 14, 2016
    aa21858
  13. added 11 commits that reference this issue on Jan 27, 2017
    4b85fa6
    049bb1e
    1c71535
    b731fab
    325979b
    9181aeb
  14. added a commit that references this issue on Feb 9, 2017
    272dc3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureiOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions