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

Improve quickzooming on Android #3136

Closed
wants to merge 1 commit into from
Closed

Improve quickzooming on Android #3136

wants to merge 1 commit into from

Conversation

brewin
Copy link
Contributor

@brewin brewin commented Nov 26, 2015

Fixes #3131 and #3132

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Nov 30, 2015
@tobrun tobrun added this to the android-v2.3.0 milestone Nov 30, 2015
@tobrun
Copy link
Member

tobrun commented Nov 30, 2015

@brewin just tried this out and this fixes #3131, awesome stuff!
As for #3132, I'm not seeing how this is being resolved.
Is this resolved without introducing that construction you mentioned in the issue itself?

@brewin
Copy link
Contributor Author

brewin commented Nov 30, 2015

I found that the fix I described was basically already implemented in ScaleGestureListener. The problem was that with mQuickZoom set to true in double-tap ACTION_MOVE, double-tap zooming would never occur even when "sloppy" taps were detected in ScaleGestureListener. Setting mQuickZoom to true in ScaleGestureListener fixes that. So now double-taps with very slight movement of the finger before ACTION_UP actually zoom in on the map instead of just being ignored. This behavior seems to be similar to how Google Maps works.

Code in ScaleGestureListener:

            // If scale is large enough ignore a tap
            mScaleFactor *= detector.getScaleFactor();
            if ((mScaleFactor > 1.05f) || (mScaleFactor < 0.95f)) {
                mZoomStarted = true;
            }

            // Ignore short touches in case it is a tap
            // Also ignore small scales
            long time = detector.getEventTime();
            long interval = time - mBeginTime;
            if (!mZoomStarted && (interval <= ViewConfiguration.getTapTimeout())) {
                return false;
            }

            if (!mZoomStarted) {
                return false;
            }

            // Cancel any animation
            mNativeMapView.cancelTransitions();

            // Gesture is a quickzoom if there aren't two fingers
            mQuickZoom = !mTwoTap;

@tobrun
Copy link
Member

tobrun commented Dec 1, 2015

Merged with 60b0e78

@brewin Awesome work! thank you for contributing

@tobrun tobrun closed this Dec 1, 2015
@brewin brewin deleted the android-quickzoom-fix branch December 15, 2015 04:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants