dock: Use visible_panels method (#1698)

Improve #1697.
This commit is contained in:
Floyd Wang 2025-11-28 11:18:09 +08:00 committed by GitHub
parent 37326819af
commit d7ff792cf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -609,11 +609,7 @@ impl TabPanel {
let is_bottom_dock = bottom_dock_button.is_some();
let panel_style = dock_area.read(cx).panel_style;
let visible_panels = self
.panels
.iter()
.filter(|panel| panel.visible(cx))
.collect::<Vec<_>>();
let visible_panels = self.visible_panels(cx).collect::<Vec<_>>();
if visible_panels.len() == 1 && panel_style == PanelStyle::default() {
let panel = visible_panels.get(0).unwrap();
@ -661,7 +657,7 @@ impl TabPanel {
.when(state.draggable, |this| {
this.on_drag(
DragPanel {
panel: (**panel).clone(),
panel: panel.clone(),
tab_panel: view,
},
|drag, _, _, cx| {