FloatingPanel icon indicating copy to clipboard operation
FloatingPanel copied to clipboard

Intrinsic floating panel - incomprehensible height calculation

Open kgrobelny-jobox opened this issue 4 years ago • 2 comments

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)?

  • Add as child view controllers

How many panels do you displays?

  • 1

Environment

Library version 2.4.1

Installation method

  • CocoaPods

iOS version(s) any

Xcode version 12.5.1

Screenshot 2021-09-21 at 20 28 38

kgrobelny-jobox avatar Sep 21 '21 18:09 kgrobelny-jobox

.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

scenee avatar Sep 25 '21 02:09 scenee

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.

jonnyijapan avatar Dec 14 '22 03:12 jonnyijapan