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.
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
BorderStylecomponent API. Aborder_stylefield onNodewouldn't be right, since styling won't affect the laid out border geometry.BorderStyleshould probably be an enum, or at least have an enum field to select the style.CSS supports the following styles:
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,GrooveandRidgestyles.The UI renderer is already capable of drawing all of them. We just need to query for the border style in
extract_uinode_bordersand render it accordingly. ForInsetandOutset, just use a darker shade for the opposite edges. ForDouble,GrooveandRidge, queue two thinner borders instead of one. To draw curved corners correctly, theBorderRadiusof the inset sub-borders will need to be clamped. I would be fine though if, to keep things simple, it ignoresBorderRadiusand 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.