From e1d6b3aaed5a1de3360411b2b148686290630129 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 4 Sep 2024 22:01:09 +0800 Subject: [PATCH] dock: Improve drop target style and size to 35%. (#217) --- crates/ui/src/dock/tab_panel.rs | 11 ++++++----- crates/ui/src/theme.rs | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index b8c57a69..ea1509e4 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -51,6 +51,7 @@ impl Render for DragPanel { .border_1() .border_color(cx.theme().border) .rounded_md() + .text_color(cx.theme().tab_foreground) .bg(cx.theme().tab_active) .opacity(0.75) .child(self.panel.title(cx)) @@ -353,7 +354,7 @@ impl TabPanel { .bg(cx.theme().drop_target) .map(|this| match self.will_split_placement { Some(placement) => { - let size = DefiniteLength::Fraction(0.25); + let size = DefiniteLength::Fraction(0.35); match placement { Placement::Left => this.left_0().top_0().bottom_0().w(size), Placement::Right => { @@ -383,13 +384,13 @@ impl TabPanel { let position = drag.event.position; // Check the mouse position to determine the split direction - if position.x < bounds.left() + bounds.size.width * 0.25 { + if position.x < bounds.left() + bounds.size.width * 0.35 { self.will_split_placement = Some(Placement::Left); - } else if position.x > bounds.left() + bounds.size.width * 0.75 { + } else if position.x > bounds.left() + bounds.size.width * 0.65 { self.will_split_placement = Some(Placement::Right); - } else if position.y < bounds.top() + bounds.size.height * 0.25 { + } else if position.y < bounds.top() + bounds.size.height * 0.35 { self.will_split_placement = Some(Placement::Top); - } else if position.y > bounds.top() + bounds.size.height * 0.75 { + } else if position.y > bounds.top() + bounds.size.height * 0.65 { self.will_split_placement = Some(Placement::Bottom); } else { // center to merge into the current tab diff --git a/crates/ui/src/theme.rs b/crates/ui/src/theme.rs index 0e365cd2..fb4999f6 100644 --- a/crates/ui/src/theme.rs +++ b/crates/ui/src/theme.rs @@ -164,6 +164,7 @@ struct Colors { pub list_active: Hsla, pub list_head: Hsla, pub link: Hsla, + pub drop_target: Hsla, } impl Colors { @@ -205,6 +206,7 @@ impl Colors { list_active: hsl(240.0, 7., 88.0).opacity(0.75), list_head: hsl(0.0, 0.0, 100.), link: hsl(221.0, 83.0, 53.0), + drop_target: hsl(235.0, 30., 44.0).opacity(0.25), } } @@ -246,6 +248,7 @@ impl Colors { list_active: hsl(240.0, 3.7, 15.0), list_head: hsl(0.0, 0.0, 6.0), link: hsl(221.0, 83.0, 53.0), + drop_target: hsl(235.0, 30., 44.0).opacity(0.1), } } } @@ -367,7 +370,7 @@ impl From for Theme { panel: colors.panel, selection: colors.selection, drag_border: crate::blue_500(), - drop_target: hsl(220.0, 65., 44.0).opacity(0.15), + drop_target: colors.drop_target, tab_bar: colors.tab_bar, tab: gpui::transparent_black(), tab_active: colors.background,