gantz_egui 0.6.1

UI traits and widgets that make up the GUI for gantz, an environment for creative systems.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! A painter-drawn status indicator dot.
//!
//! Circle glyphs (e.g. `\u{25CF}`) are not covered by egui's default fonts
//! on all platforms and can render as placeholder boxes; painting the dot
//! sidesteps fonts entirely.

/// A small filled circle tinted `color`, sized relative to body text and
/// hoverable (e.g. for a status label).
pub fn status_dot(ui: &mut egui::Ui, color: egui::Color32) -> egui::Response {
    let h = ui.text_style_height(&egui::TextStyle::Body);
    let (rect, response) = ui.allocate_exact_size(egui::vec2(h * 0.7, h), egui::Sense::hover());
    if ui.is_rect_visible(rect) {
        ui.painter().circle_filled(rect.center(), h * 0.22, color);
    }
    response
}