tiles: Add tile_radius theme option and default 0px. (#1441)

This commit is contained in:
Jason Lee 2025-10-28 10:54:41 +08:00 committed by GitHub
parent 519540eaa7
commit cc0f936348
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 5 deletions

View file

@ -1,12 +1,12 @@
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use gpui::*; use gpui::*;
use gpui_component::{ use gpui_component::{
ActiveTheme, Root, Sizable, TitleBar,
dock::{ dock::{
register_panel, DockArea, DockAreaState, DockEvent, DockItem, Panel, PanelEvent, PanelInfo, DockArea, DockAreaState, DockEvent, DockItem, Panel, PanelEvent, PanelInfo, PanelRegistry,
PanelRegistry, PanelState, PanelView, PanelState, PanelView, register_panel,
}, },
input::{InputState, TextInput}, input::{InputState, TextInput},
ActiveTheme, Root, Sizable, TitleBar,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
@ -100,7 +100,7 @@ impl Panel for ContainerPanel {
Some( Some(
div() div()
.w_24() .w_24()
.h_5() .h_6()
.px_0p5() .px_0p5()
.rounded_lg() .rounded_lg()
.border_1() .border_1()

View file

@ -890,7 +890,7 @@ impl Tiles {
// More 1px to account for the border width when 2 panels are too close // More 1px to account for the border width when 2 panels are too close
.w(item.bounds.size.width + px(1.)) .w(item.bounds.size.width + px(1.))
.h(item.bounds.size.height + px(1.)) .h(item.bounds.size.height + px(1.))
.rounded(cx.theme().radius) .rounded(cx.theme().tile_radius)
.child(h_flex().overflow_hidden().size_full().child(panel_view)) .child(h_flex().overflow_hidden().size_full().child(panel_view))
.children(self.render_resize_handles(window, cx, entity_id, &item)) .children(self.render_resize_handles(window, cx, entity_id, &item))
.child(self.render_drag_bar(window, cx, entity_id, &item)) .child(self.render_drag_bar(window, cx, entity_id, &item))

View file

@ -58,6 +58,8 @@ pub struct Theme {
pub tile_grid_size: Pixels, pub tile_grid_size: Pixels,
/// The shadow of the tile panel. /// The shadow of the tile panel.
pub tile_shadow: bool, pub tile_shadow: bool,
/// The border radius of the tile panel, default is 0px.
pub tile_radius: Pixels,
} }
impl Default for Theme { impl Default for Theme {
@ -198,6 +200,7 @@ impl From<ThemeColor> for Theme {
scrollbar_show: ScrollbarShow::default(), scrollbar_show: ScrollbarShow::default(),
tile_grid_size: px(8.), tile_grid_size: px(8.),
tile_shadow: true, tile_shadow: true,
tile_radius: px(0.),
colors, colors,
light_theme: Rc::new(ThemeConfig::default()), light_theme: Rc::new(ThemeConfig::default()),
dark_theme: Rc::new(ThemeConfig::default()), dark_theme: Rc::new(ThemeConfig::default()),