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

View file

@ -890,7 +890,7 @@ impl Tiles {
// More 1px to account for the border width when 2 panels are too close
.w(item.bounds.size.width + 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))
.children(self.render_resize_handles(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,
/// The shadow of the tile panel.
pub tile_shadow: bool,
/// The border radius of the tile panel, default is 0px.
pub tile_radius: Pixels,
}
impl Default for Theme {
@ -198,6 +200,7 @@ impl From<ThemeColor> for Theme {
scrollbar_show: ScrollbarShow::default(),
tile_grid_size: px(8.),
tile_shadow: true,
tile_radius: px(0.),
colors,
light_theme: Rc::new(ThemeConfig::default()),
dark_theme: Rc::new(ThemeConfig::default()),