use tessera_ui::{DrawCommand, PxPosition};
use super::pipeline::TextData;
#[derive(Debug, Clone, PartialEq)]
pub struct TextCommand {
pub data: TextData,
pub offset: PxPosition,
}
impl DrawCommand for TextCommand {
fn sample_region(&self) -> Option<tessera_ui::SampleRegion> {
None
}
fn apply_opacity(&mut self, opacity: f32) {
self.data.apply_opacity(opacity);
}
}
#[derive(Debug, PartialEq, Clone)]
pub struct TextConstraint {
pub max_width: Option<f32>,
pub max_height: Option<f32>,
}
impl std::hash::Hash for TextConstraint {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
if let Some(w) = self.max_width {
w.to_bits().hash(state);
} else {
0u32.hash(state); }
if let Some(h) = self.max_height {
h.to_bits().hash(state);
} else {
0u32.hash(state); }
}
}