FloatingPanel
FloatingPanel copied to clipboard
Disable top drag in "Show Panel Model" example
Description
Hello thank you for great library! All we need now, it disable top drag if panel is full or half(if full is disabled). I tried in 1.7.3 version and it was ok
Expected behavior
We drag to top and panel stay on it side or small jump to top
Actual behavior
We can drag panel to top whatever we want
Steps to reproduce
clone repository, open and run Samples project and choose Show Panel Model
Environment
Library version last
Installation method
- clone from GitHub
iOS version(s) 14.2
Xcode version 12.2
{top,bottom}InteractionBuffer
properties are removed from FloatingPanelLayout since v2. So you need to specify a panel boundary as follows.
func floatingPanelDidMove(_ vc: FloatingPanelController) {
if vc.isAttracting == false {
let loc = vc.surfaceLocation
let minY = vc.surfaceLocation(for: .full).y - 6.0
let maxY = vc.surfaceLocation(for: .tip).y + 6.0
vc.surfaceLocation = CGPoint(x: loc.x, y: min(max(loc.y, minY), maxY))
}
}]
It doesn't work when we move the panel with speed. When released, the panel jumps up for a while
Hi, @ravilich86
If vc.isAttracting == false
is removed, the panel doesn't jump up beyond the boundary after releasing it. However a floating panel would have no collision behavior so that it looks settle for a while at the top of the boundary.
@scenee thanks a lot for your work!
I've also stumbled upon this issue and your workaround works for me. However, I'm wondering, is it possible to find a better solution? Ideally, as a user, I expect that after surfaceLocation passes the limit Y, the scrollView that we provide via track(scrollView: UIScrollView)
would start scrolling instead. With your suggested workaround, it's possible to scroll the content only after the panel is at the .full
state, but for that you need to lift off the finger and then start scrolling. Would be perfect if you didn't have to lift off your finger.
Good catch, @armanarutiunov! I wasn’t aware of the use case. Thank you for letting me know. I’m addressing #455 now, which looks related to your suggestion. I would consider it to improve the continuous scroll of a panel as well.