Skip to content

Commit 02d8d45

Browse files
authored
Reset the moveAnimator prop after a move animation (#396)
* Reset the moveAnimator prop after a move animation If `moveAnimator` isn't null, `FloatingPanelPanGestureRecognizer.touchesBegan` detects `began` state quickly so that it doesn’t allow to work a tap gesture or tap action in a panel. Resolve #392 * Add 2 buttons in DebugTableViewController
1 parent 94829d2 commit 02d8d45

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Examples/Samples/Sources/ViewController.swift

+16
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ class SampleListViewController: UIViewController {
142142
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleSurface(tapGesture:)))
143143
tapGesture.cancelsTouchesInView = false
144144
tapGesture.numberOfTapsRequired = 2
145+
// Prevents a delay to response a tap in menus of DebugTableViewController.
146+
tapGesture.delaysTouchesEnded = false
145147
mainPanelVC.surfaceView.addGestureRecognizer(tapGesture)
146148
case .showNestedScrollView:
147149
mainPanelVC.panGestureRecognizer.delegateProxy = self
@@ -684,6 +686,8 @@ class DebugTableViewController: InspectableViewController {
684686
case animateScroll = "Animate Scroll"
685687
case changeContentSize = "Change content size"
686688
case reorder = "Reorder"
689+
case moveToFull = "Move to Full"
690+
case moveToHalf = "Move to Half"
687691
}
688692

689693
var reorderButton: UIButton!
@@ -725,6 +729,10 @@ class DebugTableViewController: InspectableViewController {
725729
case .reorder:
726730
button.addTarget(self, action: #selector(reorderItems), for: .touchUpInside)
727731
reorderButton = button
732+
case .moveToFull:
733+
button.addTarget(self, action: #selector(moveToFull), for: .touchUpInside)
734+
case .moveToHalf:
735+
button.addTarget(self, action: #selector(moveToHalf), for: .touchUpInside)
728736
}
729737
buttonStackView.addArrangedSubview(button)
730738
}
@@ -785,6 +793,14 @@ class DebugTableViewController: InspectableViewController {
785793
tableView.reloadData()
786794
}
787795

796+
@objc func moveToFull() {
797+
(self.parent as! FloatingPanelController).move(to: .full, animated: true)
798+
}
799+
800+
@objc func moveToHalf() {
801+
(self.parent as! FloatingPanelController).move(to: .half, animated: true)
802+
}
803+
788804
@objc func close(sender: UIButton) {
789805
// Remove FloatingPanel from a view
790806
(self.parent as! FloatingPanelController).removePanelFromParent(animated: true, completion: nil)

Sources/Core.swift

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class Core: NSObject, UIGestureRecognizerDelegate {
131131
?? FloatingPanelDefaultBehavior().removePanelAnimator(vc, from: from, with: animationVector)
132132
default:
133133
move(to: to, with: 0) {
134+
self.moveAnimator = nil
134135
updateScrollView()
135136
completion?()
136137
}

0 commit comments

Comments
 (0)