import { Nine, Theme } from "base.slint";
import { Pieces } from "pieces.slint";
import { Icons } from "icons.slint";
// Darkens the parent's area while something loads and shows the game's missing-thumbnail tile with a turning refresh
// icon on it. Put it over the panel it covers (x/y/width/height from the caller); it swallows clicks meanwhile.
// The spinner only exists while `active`, so nothing repaints continuously otherwise.
export component LoadingOverlay {
in property <bool> active;
if root.active: Rectangle {
width: root.width; height: root.height;
background: #000000a8;
TouchArea { }
Rectangle { x: (parent.width - 48px) / 2; y: (parent.height - 48px) / 2; width: 48px; height: 48px; background: Theme.pane-bg; }
Nine { x: (parent.width - 48px) / 2 - 4px; y: (parent.height - 48px) / 2 - 4px; width: 56px; height: 56px; source: Pieces.mod-explore-thumbnail-image-default-shadow; }
// Twelve 30° steps, 80 ms each: pixel art turns in steps and the binding only changes at those.
Image {
x: (parent.width - 32px) / 2; y: (parent.height - 32px) / 2; width: 32px; height: 32px;
source: Icons.refresh; colorize: Theme.disabled-text; image-rendering: pixelated;
transform-rotation: floor(mod(animation-tick() / 80ms, 12)) * 30deg;
}
}
}