♻️ Fix visibility of Shape properties

This commit is contained in:
Belén Albeza 2024-12-10 16:07:33 +01:00
parent c7c43d6313
commit 9f7428d44a
2 changed files with 57 additions and 25 deletions

View file

@ -47,17 +47,17 @@ impl Matrix {
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Shape {
pub id: Uuid,
pub children: Vec<Uuid>,
pub kind: Kind,
pub selrect: math::Rect,
pub transform: Matrix,
pub rotation: f32,
pub clip_content: bool,
id: Uuid,
children: Vec<Uuid>,
kind: Kind,
selrect: math::Rect,
transform: Matrix,
rotation: f32,
clip_content: bool,
fills: Vec<Fill>,
pub blend_mode: BlendMode,
pub opacity: f32,
pub hidden: bool,
blend_mode: BlendMode,
opacity: f32,
hidden: bool,
}
impl Shape {
@ -90,6 +90,43 @@ impl Shape {
};
}
pub fn set_kind(&mut self, kind: Kind) {
self.kind = kind;
}
pub fn set_clip(&mut self, value: bool) {
self.clip_content = value;
}
pub fn set_rotation(&mut self, angle: f32) {
self.rotation = angle;
}
pub fn set_transform(&mut self, a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) {
self.transform.a = a;
self.transform.b = b;
self.transform.c = c;
self.transform.d = d;
self.transform.e = e;
self.transform.f = f;
}
pub fn set_opacity(&mut self, opacity: f32) {
self.opacity = opacity;
}
pub fn set_hidden(&mut self, value: bool) {
self.hidden = value;
}
pub fn add_child(&mut self, id: Uuid) {
self.children.push(id);
}
pub fn clear_children(&mut self) {
self.children.clear();
}
pub fn translation(&self) -> (f32, f32) {
(self.transform.e, self.transform.f)
}