-
-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating Panel continues dragging for magic numbers #574
Comments
for this values also not working |
I tried to change lineSpacing and font of dynamic label
floatingPanel.surfaceView.frame.height = 304.6666666666667 it works |
It looks FloatingPanelAdaptiveLayoutAnchor's issue, but I don't understand the reason why this line is not working.
I guess a possible reason why the content size of the panel changes while dragging by Auto Layout configurations. If you would give me a simple sample code or project to reproduce this issue, I will be able to dive deep into it. (I'm also pleased to be format your description and comment by fenced code blocks) |
@scenee when floatingPanel.surfaceView.frame.height has periodic decimals like 304.666666666666 || 304.(6) or 259.3333333333333 259.(3) it breaks but for complete decimals like 304.6666666666667 works perfectly, I solve it by making my tableView has only integer value of height, but I think it is a bug which must be solved |
I think so too. The root cause seems to be the floating point error handling.
|
I tried to reproduce this issue, but I've not done that. I pushed iss-574 branch. I've used "Show Adaptive Panel (Custom Layout Guide)" in Samples app. Its surface height is 620.6666666666666 on iPhone 13 Pro(iOS 15.6.1), but it works well(I also tested some simulators.) |
@scenee Ok, I try to write demo project soon with this bug example |
Description
I have bottom FloatingPanelPosition, tip FloatingPanelState and anchors
return [ .tip: FloatingPanelAdaptiveLayoutAnchor(absoluteOffset: 0, contentLayout: targetGuide, referenceGuide: .safeArea) ]
, for prevent dragging up and down from current position I add code as in examplefunc floatingPanelDidMove(_ vc: FloatingPanelController) { if vc.isAttracting == false { let loc = vc.surfaceLocation print(loc) let minY = vc.surfaceLocation(for: .full).y print(minY) let maxY = vc.surfaceLocation(for: .tip).y print(maxY) vc.surfaceLocation = CGPoint(x: loc.x, y: min(max(loc.y, minY), maxY)) print(vc.surfaceLocation) } }
For one of my cases, when I have two objects in dynamic height tableView with multiline label, floating panel continues dragging
When I am printing a values of surfaceLocations I have a periodic decimals
(0.0, 532.3333384195963) // let loc = vc.surfaceLocation
944.0 // let minY = vc.surfaceLocation(for: .full).y
548.6666666666666 // let maxY = vc.surfaceLocation(for: .tip).y
(0.0, 548.6666666666666) // vc.surfaceLocation = CGPoint(x: loc.x, y: min(max(loc.y, minY), maxY))
I display 1 panel
Library version: last 2.5.2
Installation method: CocoaPods
testing device iOS version: 15.6
Xcode version: Version 13.2.1 (13C100)
Screenshot of this floating panel case
The text was updated successfully, but these errors were encountered: