fix(node): only round a box that has a border
A filled box without one is a plain rectangle: rounding it leaves the surface showing at the corners, which reads as a seam nobody asked for.
This commit is contained in:
@@ -78,13 +78,16 @@ class Painter {
|
||||
const bool hasFill = own && (own->set & S_FILL);
|
||||
if (!hasFill && !hasBorder) return;
|
||||
|
||||
const int32_t radius = tree.inherited(id, S_RADIUS).radius;
|
||||
if (hasFill && radius == 0 && !hasBorder) {
|
||||
// Only a bordered box rounds its corners. Filling a square first would leave corners
|
||||
// outside the border, and rounding an unbordered fill puts a seam where a plain panel
|
||||
// background was expected.
|
||||
if (!hasBorder) {
|
||||
gui.fillRect(n.x, n.y, n.w, n.h, own->fill);
|
||||
return;
|
||||
}
|
||||
const int32_t fill = hasFill ? own->fill : tree.inherited(id, S_BG).bg;
|
||||
gui.roundRect(n.x, n.y, n.w, n.h, radius, surfaceOf(id), &fill, &fill, hasBorder ? &own->border : nullptr);
|
||||
gui.roundRect(n.x, n.y, n.w, n.h, tree.inherited(id, S_RADIUS).radius, surfaceOf(id), &fill, &fill,
|
||||
&own->border);
|
||||
}
|
||||
|
||||
void paintButton(uint16_t id) {
|
||||
|
||||
Reference in New Issue
Block a user