Skip to content
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

Fix backdrop flickering #449

Merged
merged 2 commits into from
Apr 13, 2021
Merged

Fix backdrop flickering #449

merged 2 commits into from
Apr 13, 2021

Conversation

scenee
Copy link
Owner

@scenee scenee commented Apr 12, 2021

This issue occurs when a panel is swung down with all one's might.
The trigger is here.

    func floatingPanelWillEndDragging(_ vc: FloatingPanelController, withVelocity velocity: CGPoint, targetState: UnsafeMutablePointer<FloatingPanelState>) {
        if targetState.pointee != .full {
            owner.searchVC.hideHeader(animated: true)
        }
        if targetState.pointee == .tip {
>>>         vc.contentMode = .static
        }
    }

However, any library user expect to affect the backdrop by this code.
And then I recondiered the reason why the backdrop alpha changes in
activateLayout(for:forceLayout:) and it's because the animation using
CAAnimation.

Therefore I decided to move the point to change the backdrop alpha into
the move animation's completion handler.

And also the responsibility of setBackdropAlpha(of:) was moved into
Core because Core takes on a role of changing the backdrop alpha.

@scenee scenee force-pushed the fix-backdrop-flicker branch from d74eb23 to 724f889 Compare April 12, 2021 13:55
@scenee scenee changed the title Fix backdrop flicker Fix the backdrop flicker Apr 12, 2021
@scenee scenee force-pushed the fix-backdrop-flicker branch 2 times, most recently from 3699e4e to 49937fa Compare April 12, 2021 14:17
scenee added 2 commits April 12, 2021 23:18
This issue occurs when a panel is swung down with all one's might.
The trigger is here.
```
    func floatingPanelWillEndDragging(_ vc: FloatingPanelController, withVelocity velocity: CGPoint, targetState: UnsafeMutablePointer<FloatingPanelState>) {
        if targetState.pointee != .full {
            owner.searchVC.hideHeader(animated: true)
        }
        if targetState.pointee == .tip {
>>>         vc.contentMode = .static
        }
    }
```
However, any library user expect to affect the backdrop by this code.
And then I recondiered the reason why the backdrop alpha changes in
activateLayout(for:forceLayout:) and it's because the animation using
CAAnimation.

Therefore I decided to move the point to change the backdrop alpha into
the move animation's completion handler.

And also the responsibility of `setBackdropAlpha(of:)` was moved into
`Core` because `Core` takes on a role of changing the backdrop alpha.
@scenee scenee force-pushed the fix-backdrop-flicker branch from 49937fa to e306b9a Compare April 12, 2021 14:19
@scenee scenee changed the title Fix the backdrop flicker Fix backdrop flickering Apr 12, 2021
@scenee scenee merged commit 16e709e into master Apr 13, 2021
@scenee scenee deleted the fix-backdrop-flicker branch April 13, 2021 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant