dock: Improve drop target style and size to 35%. (#217)

This commit is contained in:
Jason Lee 2024-09-04 22:01:09 +08:00 committed by GitHub
parent d996144713
commit e1d6b3aaed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View file

@ -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

View file

@ -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<Colors> 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,