not dismiss selector on first time slide

This commit is contained in:
starfall_9000 2019-08-30 07:38:27 +07:00
parent a96e1803b0
commit 02cce73f42
2 changed files with 10 additions and 5 deletions

View File

@ -172,13 +172,16 @@ public final class ReactionButton: UIReactionControl {
if gestureRecognizer.state == .changed {
isLongPressMoved = true
selector.longPressAction(gestureRecognizer)
_ = selector.longPressAction(gestureRecognizer)
}
else if gestureRecognizer.state == .ended {
if isLongPressMoved {
selector.longPressAction(gestureRecognizer)
dismissReactionSelector()
let isPointInside = selector.longPressAction(gestureRecognizer)
if (isPointInside) {
dismissReactionSelector()
} else {
displayReactionSelector(feedback: .tapToSelectAReaction)
}
}
else {
selector.feedback = .tapToSelectAReaction

View File

@ -186,7 +186,7 @@ public final class ReactionSelector: UIReactionControl {
// MARK: - Responding to Gesture Events
@objc func longPressAction(_ gestureRecognizer: UIGestureRecognizer) {
@objc func longPressAction(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
let location = gestureRecognizer.location(in: self)
let touchIndex = optionIndexFromPoint(location)
let needsUpdate = touchIndex != stateHighlightedReactionIndex
@ -226,6 +226,8 @@ public final class ReactionSelector: UIReactionControl {
sendActions(for: isPointInsideExtendedBounds(location) ? .touchUpInside : .touchUpOutside)
}
}
return isPointInsideExtendedBounds(location)
}
// MARK: - Locating Points