Skip to content

Commit db08e92

Browse files
committed
Fix issue where drawer pan would interfere with horizontal gestures
1 parent 7994e09 commit db08e92

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

DrawerView/DrawerView.swift

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,21 +1405,19 @@ extension DrawerView: UIGestureRecognizerDelegate {
14051405

14061406
// Check if the pan gesture is primarily horizontal (like swipe-to-delete)
14071407
// If so, don't begin to allow those gestures to work
1408-
if let panGesture = gestureRecognizer as? UIPanGestureRecognizer {
1409-
let translation = panGesture.translation(in: self)
1410-
let velocity = panGesture.velocity(in: self)
1411-
1412-
// If there's meaningful translation/velocity, check direction
1413-
if abs(translation.x) > 0 || abs(translation.y) > 0 {
1414-
let isHorizontal = abs(translation.x) > abs(translation.y)
1415-
if isHorizontal {
1416-
return false
1417-
}
1418-
} else if abs(velocity.x) > 0 || abs(velocity.y) > 0 {
1419-
let isHorizontal = abs(velocity.x) > abs(velocity.y)
1420-
if isHorizontal {
1421-
return false
1422-
}
1408+
let translation = panGestureRecognizer.translation(in: self)
1409+
let velocity = panGestureRecognizer.velocity(in: self)
1410+
1411+
// If there's meaningful translation/velocity, check direction
1412+
if abs(translation.x) > 0 || abs(translation.y) > 0 {
1413+
let isHorizontal = abs(translation.x) > abs(translation.y)
1414+
if isHorizontal {
1415+
return false
1416+
}
1417+
} else if abs(velocity.x) > 0 || abs(velocity.y) > 0 {
1418+
let isHorizontal = abs(velocity.x) > abs(velocity.y)
1419+
if isHorizontal {
1420+
return false
14231421
}
14241422
}
14251423

0 commit comments

Comments
 (0)