#[derive(Debug, Clone)]
pub struct RichTextRenderData {
pub position: [f32; 2],
pub depth: f32,
pub hidden: bool,
pub needs_repaint: bool,
pub should_remove: bool,
}
impl Default for RichTextRenderData {
fn default() -> Self {
Self {
position: [0.0, 0.0],
depth: 0.0, hidden: false, needs_repaint: true, should_remove: false,
}
}
}
impl RichTextRenderData {
pub fn new(x: f32, y: f32) -> Self {
Self {
position: [x, y],
depth: 0.0,
hidden: false,
needs_repaint: true,
should_remove: false,
}
}
pub fn set_position(&mut self, x: f32, y: f32) {
if self.position[0] != x || self.position[1] != y {
self.position = [x, y];
self.needs_repaint = true;
}
}
pub fn set_hidden(&mut self, hidden: bool) {
if self.hidden != hidden {
self.hidden = hidden;
self.needs_repaint = true;
}
}
pub fn mark_for_removal(&mut self) {
self.should_remove = true;
}
pub fn clear_repaint_flag(&mut self) {
self.needs_repaint = false;
}
}