🎉 Render path fills

This commit is contained in:
Belén Albeza 2024-12-09 15:26:51 +01:00
parent 0bfcc1f854
commit 99bb3ee962
6 changed files with 118 additions and 90 deletions

View file

@ -13,7 +13,7 @@ pub use paths::*;
#[derive(Debug, Clone, PartialEq)]
pub enum Kind {
Rect,
Rect(math::Rect),
Path(Path),
}
@ -62,7 +62,7 @@ impl Shape {
Self {
id,
children: Vec::<Uuid>::new(),
kind: Kind::Rect,
kind: Kind::Rect(math::Rect::new_empty()),
selrect: math::Rect::new_empty(),
transform: Matrix::identity(),
rotation: 0.,
@ -73,6 +73,13 @@ impl Shape {
}
}
pub fn set_selrect(&mut self, left: f32, top: f32, right: f32, bottom: f32) {
self.selrect.set_ltrb(left, top, right, bottom);
if let Kind::Rect(_) = self.kind {
self.kind = Kind::Rect(self.selrect.to_owned());
}
}
pub fn translation(&self) -> (f32, f32) {
(self.transform.e, self.transform.f)
}