radioCircle
Parameters
Source
Implementation
pub fn radioCircle(active: bool, focused: bool, rs: RectScale, pressed: bool, hovered: bool, opts: Options) void {
const cornerRad = CornerRect.Physical.round(1000);
const r = rs.r;
r.fill(cornerRad, .{ .color = opts.color(.border), .fade = 1.0 });
if (focused) {
r.stroke(cornerRad, .{ .thickness = 2 * rs.s, .color = dvui.themeGet().focus });
}
var fill: Options.ColorAsk = .fill;
if (pressed) {
fill = .fill_press;
} else if (hovered) {
fill = .fill_hover;
}
var options = opts;
if (active) {
options.style = .highlight;
r.insetAll(0.5 * rs.s).fill(cornerRad, .{ .color = options.color(fill), .fade = 1.0 });
} else {
r.insetAll(rs.s).fill(cornerRad, .{ .color = opts.color(fill), .fade = 1.0 });
}
if (active) {
const thick = @max(1.0, r.w / 6);
Path.stroke(.{ .points = &.{r.center()} }, .{ .thickness = thick, .color = options.color(.text) });
}
}