FloatingPanel icon indicating copy to clipboard operation
FloatingPanel copied to clipboard

How to automatically close FPS after dragging a certain distance instead of dragging it to the bottom

Open BeingCode opened this issue 2 years ago • 2 comments

BeingCode avatar Apr 24 '22 04:04 BeingCode

You should implement method floatingPanel(_:shouldRemoveAt:with:) of delegate FloatingPanelControllerDelegate Like this:

func floatingPanel(_ fpc: FloatingPanelController, shouldRemoveAt location: CGPoint, with velocity: CGVector) -> Bool {
        let height = fpc.contentViewController?.view.bounds.height ?? 0
        if location.y > height / 2 || velocity.dy > 5.5 {
            return true
        }
        return false
    }

VisualDeceit avatar Jul 28 '22 09:07 VisualDeceit

That's right, @VisualDeceit!

scenee avatar Jul 30 '22 00:07 scenee