1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::sync::Arc;

use dioxus_native_core::prelude::SendAnyMap;
use freya_common::CachedParagraph;
use freya_engine::prelude::*;
use torin::geometry::Area;

/// Render a `label` element
pub fn render_label(area: &Area, data: &Option<Arc<SendAnyMap>>, canvas: &Canvas) {
    let paragraph = &data.as_ref().unwrap().get::<CachedParagraph>().unwrap().0;

    let x = area.min_x();
    let y = area.min_y();

    paragraph.paint(canvas, (x, y));
}