From 3cbebb99ab26375b35f0c0402abf2f89556c911f Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Fri, 25 Sep 2026 15:17:59 +0700 Subject: [PATCH] update drag handler --- crates/dock/src/tab_panel.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/dock/src/tab_panel.rs b/crates/dock/src/tab_panel.rs index 44ffc0b..85e8f27 100644 --- a/crates/dock/src/tab_panel.rs +++ b/crates/dock/src/tab_panel.rs @@ -24,6 +24,11 @@ use signed_ui::title_bar_drag_handlers; use crate::dock_area::SkinShared; use crate::{TAB_BAR_HEIGHT, t, window_controls}; +/// A rough size for the drag preview, reported to base so a drop placeholder +/// knows where to fly in from. +/// +/// The preview itself fits its content, so this is an estimate used only to +/// place the placeholder. const DRAG_PREVIEW_SIZE: gpui::Size = size(px(96.), px(30.)); const COLLAPSED_TAB_BAR_SELECTOR: &str = "signed-dock-collapsed-tab-bar"; const ACTIVE_TAB_SELECTOR: &str = "signed-dock-active-tab"; @@ -45,23 +50,21 @@ pub(crate) fn panel_title( /// The preview that follows the cursor while a panel is dragged. /// /// Base's `DragPanel` is the payload and draws nothing, this is the appearance half. +/// It fits its content rather than a fixed width, so a long title is never cut off. struct DragPanelPreview { panel: Arc, } impl Render for DragPanelPreview { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { - div() + h_flex() .id("drag-panel") .cursor_grab() - .py_1() - .px_3() - .w_24() - .overflow_hidden() + .p_1() .whitespace_nowrap() .border_1() .border_color(cx.theme().border) - .rounded(cx.theme().radius) + .rounded(cx.theme().radius_lg) .text_color(cx.theme().tab_foreground) .bg(cx.theme().tokens.tab_active) .opacity(0.75)