Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Rename flick to swipe #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sbmaxx
Copy link
Contributor

@sbmaxx sbmaxx commented Jul 22, 2014

According to android & iOS references flick gesture should be called swipe.

Details

http://developer.android.com/design/patterns/gestures.html

Swipe or drag

Scrolls overflowing content, or navigates between views in the same hierarchy. Swipes are quick and affect the screen even after the finger is picked up. Drags are slower and more precise, and the screen stops responding when the finger is picked up.

https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.html
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISwipeGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/cl/UISwipeGestureRecognizer

Gesture recognizers interpret touches to determine whether they correspond to a specific gesture, such as a swipe, pinch, or rotation.
UISwipeGestureRecognizer recognizes a swipe when the specified number of touches (numberOfTouchesRequired) have moved mostly in an allowable direction (direction) far enough to be considered a swipe. Swipes can be slow or fast. A slow swipe requires high directional precision but a small distance; a fast swipe requires low directional precision but a large distance.

P.S.

swipe gesture is more popular in other touch-events framework. That should ease the transition from them to polymer-gestures.

@visiongeist
Copy link

I see them as different gestures.

  • Flick is a fast moving in a direction before the user releases the pointer (=up)
  • While Swipe is a movement in a certain direction within a certain time frame without releasing the pointer

@sbmaxx sbmaxx added cla: yes and removed cla: no labels Jul 22, 2014
@sbmaxx
Copy link
Contributor Author

sbmaxx commented Jul 23, 2014

@visiongeist can you give any link to implementation/example of flick & swipe?

While Swipe is a movement in a certain direction within a certain time frame without releasing the pointer

I think this is a 'track' event.

@visiongeist
Copy link

I think the flick implementation is fine in the original PointerGestures however the swipe can be observed for instance on iOS7 when you open the mail app and swipe on a mail to open the menu with the trash button

@sbmaxx
Copy link
Contributor Author

sbmaxx commented Jul 23, 2014

The source of GestureRecognizer from iOS 7.1

//
//  UISwipeGestureRecognizer.h
//  UIKit
//
//  Copyright (c) 2009-2013, Apple Inc. All rights reserved.
//

#import <CoreGraphics/CoreGraphics.h>
#import <UIKit/UIGestureRecognizer.h>

// Recognizes: when numberOfTouchesRequired have moved mostly in the specified direction, enough to be considered a swipe.
//             a slow swipe requires high directional precision but a small distance
//             a fast swipe requires low directional precision but a large distance

// Touch Location Behaviors:
//     locationInView:         location where the swipe began. this is the centroid if more than one touch was involved
//     locationOfTouch:inView: location of a particular touch when the swipe began

typedef NS_OPTIONS(NSUInteger, UISwipeGestureRecognizerDirection) {
    UISwipeGestureRecognizerDirectionRight = 1 << 0,
    UISwipeGestureRecognizerDirectionLeft  = 1 << 1,
    UISwipeGestureRecognizerDirectionUp    = 1 << 2,
    UISwipeGestureRecognizerDirectionDown  = 1 << 3
};

NS_CLASS_AVAILABLE_IOS(3_2) @interface UISwipeGestureRecognizer : UIGestureRecognizer {
  @package
    CFTimeInterval    _maximumDuration;
    CGFloat           _minimumPrimaryMovement;
    CGFloat           _maximumPrimaryMovement;
    CGFloat           _minimumSecondaryMovement;
    CGFloat           _maximumSecondaryMovement;
    CGFloat           _rateOfMinimumMovementDecay;
    CGFloat           _rateOfMaximumMovementDecay;
    NSUInteger        _numberOfTouchesRequired;
    NSMutableArray   *_touches;
    UISwipeGestureRecognizerDirection _direction;

    CGPoint           _startLocation;
    CGPoint          *_startLocations;
    CFTimeInterval    _startTime;

    unsigned int      _failed:1;
}

@property(nonatomic) NSUInteger                        numberOfTouchesRequired; // default is 1. the number of fingers that must swipe
@property(nonatomic) UISwipeGestureRecognizerDirection direction;               // default is UISwipeGestureRecognizerDirectionRight. the desired direction of the swipe. multiple directions may be specified if they will result in the same behavior (for example, UITableView swipe delete)

@end

So they just define swipe as fast swipe and slow swipe :)

In iOS7's sources i didn't find any flick event — https://yadi.sk/i/vk1riM_lXAWrb .

However in IOS7 Human Interface Guidelines there are two events described: flick & swipe. This is the only mention of flick gesture i found.

At least, i think in polymer the gesture should be called swipe and it should provide not only direction, but velocity. Maybe at fast velocity should also trigger flick event for convenience.

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

Successfully merging this pull request may close these issues.

3 participants