Files
mail/ui/components/on-screen-surface.slint

27 lines
1.2 KiB
Plaintext

// Slint's software renderer (CPU mode) panics when it paints a rectangle
// reaching past ±32767 physical pixels (#35). A surface that grows with its
// content paints its fill and border only from just above the window to below
// the bottom of any screen, so cut edges, with their corner radius and border,
// stay out of view. Its width must follow the window. Unlike a Rectangle, it
// does not fill its parent, so give it a size outside a layout.
// Go back to a plain Rectangle once a Slint release fixes slint-ui/slint#14250.
export component OnScreenSurface {
in property <brush> background;
in property <length> border-radius;
in property <length> border-width;
in property <brush> border-color;
private property <length> paint-top: -root.absolute-position.y - 32px;
private property <length> paint-bottom: 16384phx - root.absolute-position.y;
Rectangle {
y: clamp(root.paint-top, 0px, root.height);
height: clamp(root.paint-bottom, 0px, root.height) - self.y;
background: root.background;
border-radius: root.border-radius;
border-width: root.border-width;
border-color: root.border-color;
}
@children
}