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.

Make gesture focal point configurable #4924

Closed

Description

@tobrun

tldr we need to expose a user configurable focal point. A focal represents the x,y value on which a gesture works. In normal cases the x,y from the MotionEvent is used. We need to make this configurable

Currently we already expose an API that works similar to a focal point implementation. When you enable the tracking mode on MyLocationView you also change the focal point to follow that view. An example how that now looks:

                    // Single finger double tap
                    if (mMapboxMap.getTrackingSettings().isLocationTrackingDisabled()) {
                        // Zoom in on gesture
                        zoom(true, e.getX(), e.getY());
                    } else {
                        // Zoom in on user location view
                        // getCenterX also takes in account padding + insets
                        zoom(true, mMyLocationView.getCenterX(), mMyLocationView.getCenterY());
                    }

To be able to support all different use-cases users are requesting we need to expose an API as:

mapboxMap.getUiSettings().setFocalPoint(x,y);

People will mostly use this to center the focal point

mapboxMap.getUiSettings().setFocalPoint(mapView.getWidth()/2,mapView.getHeight()2));

It would be nice to be able to limit if-else in the gesture code above and use a factory pattern to provide an implementation instead.

Activity

  1. added
    Android
    on May 3, 2016
  2. 1ec5 commented on May 3, 2016

    @1ec5
    Contributor

    A common use case would be to focus zooming on the selected marker. In fact, I suspect that would account for the majority of requests for this feature.

  3. added this to the android-v4.2.0 milestone on Jun 4, 2016
  4. 1ec5 commented on Jun 10, 2016

    @1ec5
    Contributor

    For the iOS SDK, a configurable gesture anchor point was introduced in #5302. It affects all gestures except for panning.

  5. tobrun commented on Jun 13, 2016

    @tobrun
    MemberAuthor

    Here you can see the gesture in action:

    ezgif com-video-to-gif 32

  6. bleege commented on Jun 13, 2016

    @bleege
    Contributor

    Squashed, Rebased, and Merged into release-android-v4.1.0.

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

    Androidfeature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions