pub trait MovableNode: Clone + 'static {
// Required methods
fn id(&self) -> i32;
fn x(&self) -> f32;
fn y(&self) -> f32;
fn selected(&self) -> bool;
fn set_x(&mut self, x: f32);
fn set_y(&mut self, y: f32);
}Expand description
Trait for nodes that can be moved (dragged) in the editor. This allows generic logic to update node positions.
selected is part of the contract because a drag commits the co-selected
set, not just the dragged node — and it must read that from the same place
the rendering does. The row already carries the flag (the editor renders it
from there); asking a separate set instead is what lets a drag’s visuals and
its commit disagree.
Required Methods§
fn id(&self) -> i32
fn x(&self) -> f32
fn y(&self) -> f32
fn selected(&self) -> bool
fn set_x(&mut self, x: f32)
fn set_y(&mut self, y: f32)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".