| 643 | if self.sidebar_tab == tab { |
| 644 | return; |
| 645 | } |
| 646 | self.sidebar_tab = tab; |
| 647 | self.sidebar_tab_transition.restart(); |
| 648 | if self.sidebar_visible { |
| 649 | self.sidebar_tween.animate_to(self.sidebar_target_width()); |
| 650 | } |
| 651 | cx.notify(); |
| 652 | } |
| 653 | |
| 654 | fn sidebar_target_width(&self) -> f32 { |
| 655 | if self.sidebar_tab == SidebarTab::Environments { |
| 656 | self.sidebar_width.max(340.0) |
| 657 | } else { |
| 658 | self.sidebar_width |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | fn show_sidebar(&mut self, tab: SidebarTab, cx: &mut Context<Self>) { |
| 663 | if self.sidebar_tab != tab { |
| 664 | self.sidebar_tab_transition.restart(); |
| 665 | } |
| 666 | self.sidebar_tab = tab; |
| 667 | self.sidebar_visible = true; |
| 668 | self.ui_preferences.sidebar_visible = true; |
| 669 | self.sidebar_tween.animate_to(self.sidebar_target_width()); |
| 670 | self.persist_ui_preferences(); |
| 671 | cx.notify(); |
| 672 | } |
| 673 | |
| 674 | pub fn set_history_filter(&mut self, filter: HistoryFilter, cx: &mut Context<Self>) { |
| 675 | self.history_filter = filter; |