egui/atomics/
sized_atom_kind.rs1use crate::{Id, Image};
2use emath::Vec2;
3use epaint::Galley;
4use std::sync::Arc;
5
6#[derive(Clone, Default, Debug)]
8pub enum SizedAtomKind<'a> {
9 #[default]
10 Empty,
11 Text(Arc<Galley>),
12 Image(Image<'a>, Vec2),
13 Custom(Id),
14}
15
16impl SizedAtomKind<'_> {
17 pub fn size(&self) -> Vec2 {
19 match self {
20 SizedAtomKind::Text(galley) => galley.size(),
21 SizedAtomKind::Image(_, size) => *size,
22 SizedAtomKind::Empty | SizedAtomKind::Custom(_) => Vec2::ZERO,
23 }
24 }
25}