-
-
Notifications
You must be signed in to change notification settings - Fork 514
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
FloatingPanel is hard to dismiss if isRemovalInteractionEnabled is enabled #389
Comments
@aclassen Thank you for your feedback. You can make it easy to remove a panel using But now I'm thinking the API should be reconsidered because the logic, which the velocity vector is calculated from a distance to a point of the hidden state and the pan gesture's velocity, is not appropriate for a gesture. So I have an idea that the core will use just a velocity of the panel pan gesture to determine whether a pane is removed or not, and then the delegate method will pass it to the argument. |
I was able to do a workaround and now is working nicely.
|
@scenee I also find it very hard to remove the panel after upgrading to 2.0.0 today. Do you have an example of how to use the "ShouldRemoveAt" method to determine if the panel should be removed or not? I am not sure how to use location and velocity to calculate if the shouldRemoveAt method should return true or false here. |
@sipersso func floatingPanel(_ fpc: FloatingPanelController, shouldRemoveAt location: CGPoint, with velocity: CGVector) -> Bool {
let threshold: CGFloat = 5.0
switch fpc.layout.position {
case .top:
return (velocity.dy <= -threshold)
case .left:
return (velocity.dx <= -threshold)
case .bottom:
return (velocity.dy >= threshold)
case .right:
return (velocity.dx >= threshold)
}
} The default value of |
@scenee I just tried this with 5.0 and it works perfectly. Thank you! |
Because the current threshold(10.0) makes it hard to remove a panel. Resolve #389
After I tried the above new logic, I confirmed the current logic was better because a swipe speed to dismiss a panel and ease of the acceleration can change depending on a distance from a screen edge to hide it. As a result, I'm going to ease a threshold to remove a panel in PR #395. |
Because the current threshold(10.0) makes it hard to remove a panel. Resolve #389
Description
If isRemovalInteractionEnabled enabled, the panel is actually "hard" to dismiss compared to panel v1.
In v1 the panel was also dismissed if it was dragged no near bottom.
In v2 the panel is only dismissed if the panel is dragged with a very high velocity.
Expected behavior
The panel is easier to dismiss if isRemovalInteractionEnabled is enabled.
Actual behavior
Steps to reproduce
Open a example app panel where isRemovalInteractionEnabled is enabled.
Code example that reproduces the issue
How do you display panel(s)?
How many panels do you displays?
Environment
Library version
2.0.0
Installation method
iOS version(s)
14.0
Xcode version
Version 12.0.1 (12A7300)
The text was updated successfully, but these errors were encountered: