Resize handles: the line is a filled hairline, since gpui paints a border no wider than half its box: a split's divider, a resizable box's edge and a column's border drew half a pixel, and none at a scale of one
CI / platforms (ubuntu-24.04) (push) Waiting to run
CI / site (push) Successful in 25s
CI / platforms (windows-latest) (push) Successful in 4m36s
CI / crate (push) Failing after 12m30s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-16 20:10:03 -04:00
1 parent 5c2822cfb6
commit 005faefd5d
2 files changed
+8 -7

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ Ely GPUI Component. A component library for GPUI, in light and dark.
- Colors, control and icon sizes, text sizes, radii, shadows come from `cx.theme()`. No raw `px()` literals inside components.
- Gaps and padding use gpui's rem scale helpers (`gap_2`, `px_3`). That scale is the spacing system.
- Borders use gpui's fixed-pixel helpers (`border_1` is 1px). Hairlines do not scale.
- Borders use gpui's fixed-pixel helpers (`border_1` is 1px). Hairlines do not scale. gpui paints a border no wider than half its box, so a line as thin as its box is a fill, `w_px` or `h_px` with `bg`, as the resize handles draw theirs.
- One component, one home. Duplicates point to it.
- Fail fast. No silent fallbacks. Log state changes with `log`.
- A handler a component needs is an argument of `new`, so leaving it out fails to compile. A state live data or the outside world can reach, a key gone from a list that changed or a failed load, logs an error naming the owner and draws a visible state, nothing chosen or an error line, and the app runs on. An assert on a caller's argument or on a fact true by construction stays; one that runtime data or input can trip is fixed. Chapters move to this as `tasks/panics.md` ticks them.
+7 -6
View File
@@ -29,6 +29,7 @@ fn handle(id: impl Into<ElementId>, axis: Axis, line: Hsla, cx: &App) -> Statefu
.flex()
.justify_center()
.items_center();
// A filled line: gpui paints a border no wider than half its box.
match axis {
Axis::Horizontal => base
.w(hit)
@@ -36,10 +37,10 @@ fn handle(id: impl Into<ElementId>, axis: Axis, line: Hsla, cx: &App) -> Statefu
.cursor(CursorStyle::ResizeLeftRight)
.child(
div()
.w_px()
.h_full()
.border_l_1()
.border_color(line)
.group_hover("resize", |s| s.border_color(lit)),
.bg(line)
.group_hover("resize", |s| s.bg(lit)),
),
Axis::Vertical => base
.h(hit)
@@ -47,10 +48,10 @@ fn handle(id: impl Into<ElementId>, axis: Axis, line: Hsla, cx: &App) -> Statefu
.cursor(CursorStyle::ResizeUpDown)
.child(
div()
.h_px()
.w_full()
.border_t_1()
.border_color(line)
.group_hover("resize", |s| s.border_color(lit)),
.bg(line)
.group_hover("resize", |s| s.bg(lit)),
),
}
}