Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset the moveAnimator prop after a move animation #396

Merged
merged 2 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Examples/Samples/Sources/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ class SampleListViewController: UIViewController {
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleSurface(tapGesture:)))
tapGesture.cancelsTouchesInView = false
tapGesture.numberOfTapsRequired = 2
// Prevents a delay to response a tap in menus of DebugTableViewController.
tapGesture.delaysTouchesEnded = false
mainPanelVC.surfaceView.addGestureRecognizer(tapGesture)
case .showNestedScrollView:
mainPanelVC.panGestureRecognizer.delegateProxy = self
Expand Down Expand Up @@ -684,6 +686,8 @@ class DebugTableViewController: InspectableViewController {
case animateScroll = "Animate Scroll"
case changeContentSize = "Change content size"
case reorder = "Reorder"
case moveToFull = "Move to Full"
case moveToHalf = "Move to Half"
}

var reorderButton: UIButton!
Expand Down Expand Up @@ -725,6 +729,10 @@ class DebugTableViewController: InspectableViewController {
case .reorder:
button.addTarget(self, action: #selector(reorderItems), for: .touchUpInside)
reorderButton = button
case .moveToFull:
button.addTarget(self, action: #selector(moveToFull), for: .touchUpInside)
case .moveToHalf:
button.addTarget(self, action: #selector(moveToHalf), for: .touchUpInside)
}
buttonStackView.addArrangedSubview(button)
}
Expand Down Expand Up @@ -785,6 +793,14 @@ class DebugTableViewController: InspectableViewController {
tableView.reloadData()
}

@objc func moveToFull() {
(self.parent as! FloatingPanelController).move(to: .full, animated: true)
}

@objc func moveToHalf() {
(self.parent as! FloatingPanelController).move(to: .half, animated: true)
}

@objc func close(sender: UIButton) {
// Remove FloatingPanel from a view
(self.parent as! FloatingPanelController).removePanelFromParent(animated: true, completion: nil)
Expand Down
1 change: 1 addition & 0 deletions Sources/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class Core: NSObject, UIGestureRecognizerDelegate {
?? FloatingPanelDefaultBehavior().removePanelAnimator(vc, from: from, with: animationVector)
default:
move(to: to, with: 0) {
self.moveAnimator = nil
updateScrollView()
completion?()
}
Expand Down