UI node border styles
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Support rendering borders in different styles:
https://iqratechnology.com/academy/css-training/css-borders/
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/border-style
## What solution would you like?
Use a `BorderStyle` component API. A `border_style` field on `Node` wouldn't be right, since styling won't affect the laid out border geometry.
`BorderStyle` should probably be an enum, or at least have an enum field to select the style.
CSS supports the following styles:
* none
* hidden
* solid
* dotted
* dashed
* double
* groove
* ridge
* inset
* outset
Since we don't support tables, there's no point in having "none" and "hidden".
My suggestion would be to start with an initial PR that supports `Solid`, `Double`, `Inset`, `OutSet`, `Groove` and `Ridge` styles.
The UI renderer is already capable of drawing all of them. We just need to query for the border style in `extract_uinode_borders` and render it accordingly. For `Inset` and `Outset`, just use a darker shade for the opposite edges. For `Double`, `Groove` and `Ridge`, queue two thinner borders instead of one. To draw curved corners correctly, the `BorderRadius` of the inset sub-borders will need to be clamped. I would be fine though if, to keep things simple, it ignores `BorderRadius` and only supports right angled corners for the new border styles.
Dashed and dotted borders are much more difficult and would need some math and changes to shaders.
Contributor guide
Research direction
Start by inspecting `extract_uinode_borders` and the existing UI renderer border path to understand how border geometry and rendering are represented. Add the proposed Solid, Double, Inset, Outset, Groove, and Ridge styles through a `BorderStyle` component API, with the renderer producing the corresponding borders. Done means these styles render correctly, while dashed and dotted styles remain out of scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100