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

Make gesture focal point configurable #4924

Closed
tobrun opened this issue May 3, 2016 · 4 comments
Closed

Make gesture focal point configurable #4924

tobrun opened this issue May 3, 2016 · 4 comments
Labels
Android Mapbox Maps SDK for Android feature

Comments

@tobrun
Copy link
Member

tobrun commented May 3, 2016

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.

@tobrun tobrun added feature Android Mapbox Maps SDK for Android labels May 3, 2016
@1ec5
Copy link
Contributor

1ec5 commented May 3, 2016

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.

@1ec5
Copy link
Contributor

1ec5 commented Jun 10, 2016

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

@tobrun
Copy link
Member Author

tobrun commented Jun 13, 2016

Here you can see the gesture in action:

ezgif com-video-to-gif 32

@bleege
Copy link
Contributor

bleege commented Jun 13, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android feature
Projects
None yet
Development

No branches or pull requests

3 participants