FloatingPanel icon indicating copy to clipboard operation
FloatingPanel copied to clipboard

Set max/min anchor for FloatingPanelAdaptiveLayoutAnchor

Open AlvaroFranco opened this issue 4 years ago • 1 comments

Description

When using FloatingPanelAdaptiveLayoutAnchor, if I use a layout guide tallest than the actual screen size, the floating panel doesn't adapt to the screen height and is not even possible to close the panel

Expected behavior

The adaptive layout should be able to receive a max and/or min anchor in case the layout guide provided exceeds those anchors, the panel should resize to the max/min anchor

Actual behavior

The panel will exceed the screen size if the layout guide is tallest than the screen

Steps to reproduce

Create a regular floating panel with adaptive layout:

floatingPanel.set(contentViewController: view1)
floatingPanel.isRemovalInteractionEnabled = true
floatingPanel.layout = CustomFloatingPanelAdaptiveLayout(targetGuide: view1.mainSpace)
            
self.present(floatingPanel, animated: true, completion: nil)

Update the layout guide to fit the whole view content:

mainSpace.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true
mainSpace.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
mainSpace.bottomAnchor.constraint(equalTo: lastItem.bottomAnchor, constant: 20).isActive = true

If lastItem y position is bigger than the actual safeArea size, the panel won't resize to fit into the screen

How do you display panel(s)?

  • Present modally

How many panels do you displays?

  • 1

Environment

Library version

2.4.0

Installation method

  • CocoaPods

iOS version(s)

14.5.1

Xcode version

12.5

AlvaroFranco avatar Jun 16 '21 13:06 AlvaroFranco

Thank you for your suggestion. I'm planning to improve this behavior like https://github.com/scenee/FloatingPanel/discussions/469#discussioncomment-800436

scenee avatar Jul 03 '21 06:07 scenee