From c303b8430322c238397597b842dbaa0bd18aac37 Mon Sep 17 00:00:00 2001 From: ihavecoke Date: Sun, 23 Feb 2025 22:22:27 +0800 Subject: [PATCH] dock: Add item to tiles layout should use default TabPanel view (#645) --- crates/ui/src/dock/mod.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/ui/src/dock/mod.rs b/crates/ui/src/dock/mod.rs index 5f28b2d6..dc570a4f 100644 --- a/crates/ui/src/dock/mod.rs +++ b/crates/ui/src/dock/mod.rs @@ -343,11 +343,19 @@ impl DockItem { stack_panel.add_panel(new_item.view(), None, dock_area.clone(), window, cx); }); } - Self::Tiles { view, .. } => { + Self::Tiles { view, items } => { + let tile_item = TileItem::new( + Arc::new(cx.new(|cx| { + let mut tab_panel = TabPanel::new(None, dock_area.clone(), window, cx); + tab_panel.add_panel(panel.clone(), window, cx); + tab_panel + })), + bounds.unwrap_or_else(|| TileMeta::default().bounds), + ); + + items.push(tile_item.clone()); view.update(cx, |tiles, cx| { - let bounds = bounds.unwrap_or_else(|| TileMeta::default().bounds); - tiles.add_item(TileItem::new(panel.clone(), bounds), dock_area, window, cx); - cx.notify(); + tiles.add_item(tile_item, dock_area, window, cx); }); } Self::Panel { .. } => {}