forked from reya/gpui-native-kit
Move layout metrics into theme and apply audit cleanups
This commit is contained in:
@@ -7,12 +7,8 @@ use gpui::{
|
||||
IntoElement, MouseButton, ParentElement as _, Pixels, Point, ResizeEdge, Size, Styled as _,
|
||||
Tiling, Window, canvas, div, point, px, size,
|
||||
};
|
||||
use gpui_native_theme::ActiveTheme as _;
|
||||
use gpui_native_theme::{ActiveTheme as _, BORDER_WIDTH, WINDOW_RESIZE_INSET};
|
||||
|
||||
/// The width of the band inside the window's edge that resizes it.
|
||||
const RESIZE_INSET: f32 = 4.0;
|
||||
/// The hairline around the content.
|
||||
const BORDER_WIDTH: f32 = 1.0;
|
||||
/// How much of the shadow's strength survives losing window focus.
|
||||
const INACTIVE_SHADOW_OPACITY: f32 = 0.7;
|
||||
|
||||
@@ -28,7 +24,7 @@ pub fn frame(child: impl IntoElement, window: &mut Window, cx: &App) -> Div {
|
||||
tiling
|
||||
};
|
||||
|
||||
let inset = px(RESIZE_INSET);
|
||||
let inset = WINDOW_RESIZE_INSET;
|
||||
let border = cx.theme().colors.border;
|
||||
let radius = cx.theme().radius.overlay;
|
||||
|
||||
@@ -75,10 +71,10 @@ pub fn frame(child: impl IntoElement, window: &mut Window, cx: &App) -> Div {
|
||||
.size_full()
|
||||
.overflow_hidden()
|
||||
.border_color(border)
|
||||
.when(!tiling.top, |surface| surface.border_t(px(BORDER_WIDTH)))
|
||||
.when(!tiling.bottom, |surface| surface.border_b(px(BORDER_WIDTH)))
|
||||
.when(!tiling.left, |surface| surface.border_l(px(BORDER_WIDTH)))
|
||||
.when(!tiling.right, |surface| surface.border_r(px(BORDER_WIDTH)))
|
||||
.when(!tiling.top, |surface| surface.border_t(BORDER_WIDTH))
|
||||
.when(!tiling.bottom, |surface| surface.border_b(BORDER_WIDTH))
|
||||
.when(!tiling.left, |surface| surface.border_l(BORDER_WIDTH))
|
||||
.when(!tiling.right, |surface| surface.border_r(BORDER_WIDTH))
|
||||
.when(!(tiling.top || tiling.left), |surface| {
|
||||
surface.rounded_tl(radius)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user