scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS
MIT License
5.61k stars 509 forks source link

setup backdropView.dismissalTapGestureRecognizer.isEnabled = true, tap backdropView not work! #648

Closed 778477 closed 1 month ago

778477 commented 1 month ago

Description

setup fpc.backdropView.dismissalTapGestureRecognizer.isEnabled = true

when fpc in tip state, backdropView don't respond the dismissalTapGesture change state to full, backdropView's dismissalTapGestureRecognizer is work.

Expected behavior

when setup fpc.backdropView.dismissalTapGestureRecognizer.isEnabled = true, whatever current state, tap backdropView to dismiss FloatingPanel

Actual behavior

see desc

    init(_ vc: FloatingPanelController, layout: FloatingPanelLayout, behavior: FloatingPanelBehavior) {
        ownerVC = vc

        surfaceView = SurfaceView()
        surfaceView.position = layout.position
        surfaceView.backgroundColor = .white

        backdropView = BackdropView()
        backdropView.backgroundColor = .black
        backdropView.alpha = 0.0

initial backdropView.alpha = 0.0 will ignore the gesture.

Maybe need replace alpha with UIColor.clearColor

Steps to reproduce

Code example that reproduces the issue

How do you display panel(s)?

How many panels do you displays?

Environment

Library version 2.8.6

Installation method

iOS version(s) iOS 17.0

Xcode version Xcode 16.0

scenee commented 1 month ago

Hi @778477 This is the expected behavior. The dismissal tap is designed to work only when its backdrop view alpha is zero because the backdrop view doesn't appear in UI and user interactions should be passed through the backgound view(main content).