Make "swipe for info" RTL compatible

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 54f7c298b7
commit 7734958eec

@ -283,7 +283,7 @@ const CGFloat OWSMessageCellCornerRadius = 17;
[self.textBubbleImageView addGestureRecognizer:textLongPress];
PanDirectionGestureRecognizer *panGesture =
[[PanDirectionGestureRecognizer alloc] initWithDirection:PanDirectionForward
[[PanDirectionGestureRecognizer alloc] initWithDirection:(self.isRTL ? PanDirectionLeft : PanDirectionRight)
target:self
action:@selector(handlePanGesture:)];
[self addGestureRecognizer:panGesture];

@ -6,7 +6,7 @@ import UIKit.UIGestureRecognizerSubclass
@objc
enum PanDirection: Int {
case forward, backward, up, down, any
case left, right, up, down, any
}
@objc
@ -33,13 +33,13 @@ class PanDirectionGestureRecognizer: UIPanGestureRecognizer {
let deltaX = previousLocation.x - location.x
switch direction {
case .down where deltaY < 0:
return
case .up where deltaY > 0:
return
case .forward where deltaX < 0:
case .down where deltaY < 0:
return
case .left where deltaX > 0:
return
case .backward where deltaX > 0:
case .right where deltaX < 0:
return
default:
break
@ -52,7 +52,7 @@ class PanDirectionGestureRecognizer: UIPanGestureRecognizer {
if state == .began {
let vel = velocity(in: view)
switch direction {
case .forward, .backward:
case .left, .right:
if fabs(vel.y) > fabs(vel.x) {
state = .cancelled
}

Loading…
Cancel
Save