scenee / FloatingPanel

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

Intrinsic floating panel - incomprehensible height calculation #503

Open kgrobelny-jobox opened 3 years ago

kgrobelny-jobox commented 3 years ago

Description

The height of the panel is calculated in an awkward way on different screen sizes. See the attached screenshot.

Expected behavior

The height of the panel is calculated consistently throughout the iPhone devices lineup.

Actual behavior

There are weird, bigger vertical spaces on devices with "safe area"

Steps to reproduce

Just run the Samples example and open an intrinsic panel by tapping on "Show Intrinsic View".

How do you display panel(s)?

How many panels do you displays?

Environment

Library version 2.4.1

Installation method

iOS version(s) any

Xcode version 12.5.1

Screenshot 2021-09-21 at 20 28 38
scenee commented 3 years ago

.superview reference guide changes the behavior as you expected.

-            .full: FloatingPanelIntrinsicLayoutAnchor(fractionalOffset: 0.0, referenceGuide: .safeArea)
+            .full: FloatingPanelIntrinsicLayoutAnchor(fractionalOffset: 0.0, referenceGuide: .superview)

https://github.com/scenee/FloatingPanel/blob/2.4.1/Examples/Samples/Sources/Layouts.swift#L40

jonnyijapan commented 1 year ago

It seems like there is something strange or buggy when using referenceGuide: .safeArea. Changing to referenceGuide: .superview seems to give expected results. And in fact it seems like doing FloatingPanelIntrinsicLayoutAnchor(fractionalOffset: 0.0, referenceGuide: .superview) as suggested above does in fact tie the used view to the bottom safe area, and not device edge.