FloatingPanel icon indicating copy to clipboard operation
FloatingPanel copied to clipboard

Disable top drag in "Show Panel Model" example

Open Sergionius opened this issue 4 years ago • 5 comments

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 ezgif-1-c8b373c50ccd

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

Sergionius avatar Nov 27 '20 12:11 Sergionius

{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))
    }
}]

From README > Specify the panel move's boundary

scenee avatar Jan 15 '21 13:01 scenee

It doesn't work when we move the panel with speed. When released, the panel jumps up for a while

ravilich86 avatar May 31 '21 06:05 ravilich86

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 avatar May 31 '21 12:05 scenee

@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.

armanarutiunov avatar Jun 14 '21 19:06 armanarutiunov

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.

scenee avatar Jun 16 '21 12:06 scenee