Fixed sidebar UI is not hidden when with on mouse over option

fix https://github.com/brave/brave-browser/issues/39522

Animation should be reset to start or end position to show/hide
properly unless it's not started in the middle of position.
This commit is contained in:
Simon Hong
2024-07-02 11:38:56 +09:00
parent e893373068
commit 019e7fffeb
@@ -522,6 +522,9 @@ void SidebarContainerView::ShowSidebar(bool show_side_panel) {
if (width_animation_.is_animating() && width_animation_.IsClosing()) {
DVLOG(1) << __func__ << ": stop hiding and start showing from there.";
width_animation_.Stop();
} else {
// Otherwise, reset animation to start from the beginning.
width_animation_.Reset();
}
// Calculate the start & end width for animation. Both are used when
@@ -607,6 +610,9 @@ void SidebarContainerView::HideSidebar(bool hide_sidebar_control) {
if (width_animation_.is_animating() && width_animation_.IsShowing()) {
DVLOG(1) << __func__ << ": stop showing and start hiding from there.";
width_animation_.Stop();
} else {
// Otherwise, reset animation to hide from the end.
width_animation_.Reset(1.0);
}
// Calculate the start & end width for animation. Both are used when