Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b1cb68f0a | |||
| 4ba8acaf08 | |||
| 02d8d4516c | |||
| 94829d2749 | |||
| 1522a0990f | |||
| 2e3bbaeec2 |
@@ -194,8 +194,8 @@ class MyPanelIntrinsicLayout: FloatingPanelLayout {
|
||||
var initialState: FloatingPanelState { .full }
|
||||
var anchors: [FloatingPanelState : FloatingPanelLayoutAnchoring] {
|
||||
return [
|
||||
.full: FloatingPanelIntrinsicLayoutAnchor(absoluteOffset: 16.0, referenceGuide: .safeArea)
|
||||
.half: FloatingPanelIntrinsicLayoutAnchor(fractionalOffset: 0.5, referenceGuide: .safeArea)
|
||||
.full: FloatingPanelIntrinsicLayoutAnchor(absoluteOffset: 16.0, referenceGuide: .safeArea),
|
||||
.half: FloatingPanelIntrinsicLayoutAnchor(fractionalOffset: 0.5, referenceGuide: .safeArea),
|
||||
.tip: FloatingPanelLayoutAnchor(absoluteInset: 44.0, edge: .bottom, referenceGuide: .safeArea)
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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!
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "FloatingPanel"
|
||||
s.version = "2.0.0"
|
||||
s.version = "2.0.1"
|
||||
s.summary = "FloatingPanel is a clean and easy-to-use UI component of a floating panel interface."
|
||||
s.description = <<-DESC
|
||||
FloatingPanel is a clean and easy-to-use UI component for a new interface introduced in Apple Maps, Shortcuts and Stocks app.
|
||||
|
||||
+6
-4
@@ -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?()
|
||||
}
|
||||
@@ -717,15 +718,16 @@ class Core: NSObject, UIGestureRecognizerDelegate {
|
||||
if let result = vc.delegate?.floatingPanel?(vc, shouldRemoveAt: vc.surfaceLocation, with: velocityVector) {
|
||||
return result
|
||||
}
|
||||
let threshold = CGFloat(5.5)
|
||||
switch layoutAdapter.position {
|
||||
case .top:
|
||||
return (velocityVector.dy <= -10.0)
|
||||
return (velocityVector.dy <= -threshold)
|
||||
case .left:
|
||||
return (velocityVector.dx <= -10.0)
|
||||
return (velocityVector.dx <= -threshold)
|
||||
case .bottom:
|
||||
return (velocityVector.dy >= 10.0)
|
||||
return (velocityVector.dy >= threshold)
|
||||
case .right:
|
||||
return (velocityVector.dx >= 10.0)
|
||||
return (velocityVector.dx >= threshold)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.0</string>
|
||||
<string>2.0.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
</dict>
|
||||
|
||||
Reference in New Issue
Block a user