pub struct Element {
pub id: ElementId,
pub kind: ElementKind,
pub transform: Transform,
pub selected: bool,
pub interactive: bool,
pub parent: Option<ElementId>,
}Expand description
A canvas element with content and transform.
Fields§
§id: ElementIdUnique identifier.
kind: ElementKindElement content type.
transform: TransformPosition and size.
selected: boolWhether this element is selected.
interactive: boolWhether this element can be interacted with.
parent: Option<ElementId>Optional parent element ID (for grouped elements).
Implementations§
Source§impl Element
impl Element
Sourcepub fn new(kind: ElementKind) -> Self
pub fn new(kind: ElementKind) -> Self
Create a new element with the given kind.
Sourcepub fn with_transform(self, transform: Transform) -> Self
pub fn with_transform(self, transform: Transform) -> Self
Set the transform.
Sourcepub fn with_interactive(self, interactive: bool) -> Self
pub fn with_interactive(self, interactive: bool) -> Self
Set whether the element is interactive.
Sourcepub fn contains_point(&self, x: f32, y: f32) -> bool
pub fn contains_point(&self, x: f32, y: f32) -> bool
Check if a point (in canvas coordinates) is within this element.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Element
impl<'de> Deserialize<'de> for Element
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&Element> for ElementDocument
impl From<&Element> for ElementDocument
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more