WorldWindEarth / WorldWindAndroid

The WorldWind Android "Community Edition" SDK (WWA-CE) includes the library, examples and tutorials for building 3D virtual globe applications for phones and tablets.
https://worldwind.earth/WorldWindAndroid/
Other
16 stars 7 forks source link

Avoid three-fingered gestures #8

Closed ComBatVision closed 5 years ago

ComBatVision commented 5 years ago

To make all gestures two-fingered just limit pan gesture to one finger and use two fingers for tilt instead of three in WorldWindowController.

        ((PanRecognizer) panRecognizer).setMaxNumberOfPointers(1); // Do not pan during tilt
        ((PanRecognizer) tiltRecognizer).setMinNumberOfPointers(2); // Use two fingers for tilt gesture

and lock tilt if rotation starts and otherwise:

        // Handle dependent gestures lock
        if(handled) {
            tiltRecognizer.setEnabled(!isInProcess(rotationRecognizer) || !rotationRecognizer.isEnabled());
            rotationRecognizer.setEnabled(!isInProcess(tiltRecognizer) || !tiltRecognizer.isEnabled());
        }
    private boolean isInProcess(GestureRecognizer recognizer) {
        return recognizer.getState() == WorldWind.BEGAN || recognizer.getState() == WorldWind.CHANGED;
    }

Or may be better solution to use transitionToState(WorldWind.FAILED) instead of disabling dependent gestures. I need to investigate this approach.

ComBatVision commented 5 years ago

I have done this on feature/refactor-camera branch. Will merge it soon.