Realm

oa::ui::NodeCanvas

Node-graph canvas navigation, coordinate mapping, and hit tests. Caller-owned; passed to crate::ui::Ui::node_canvas_grid to render the background grid. Pan/zoom mutations cancel any running fit animation; fit_to_view starts one that step_animation advances. Donor: oa::NodeCanvas.

StRust public API

Declaration

pub struct NodeCanvas { /* private fields */ }
Public Rust declaration.

Public Methods

pub const fn state(&self) -> &NodeCanvasState
pub const fn is_animating(&self) -> bool
pub fn set_state(&mut self, state: NodeCanvasState) -> Result<()>
pub fn set_view_size(&mut self, w: f32, h: f32) -> Result<()>
pub fn world_to_screen(&self, world: [f32; 2]) -> [f32; 2]
pub fn screen_to_world(&self, screen: [f32; 2]) -> [f32; 2]
pub fn visible_world_rect(&self) -> WorldAabb
pub fn hit_test( &self, screen: [f32; 2], items: &[NodeCanvasHitItem], ) -> Result<Option<NodeCanvasHit>>
pub fn grid( &self, minimum_screen_spacing: f32, base_world_step: f32, major_every: u32, super_major_every: u32, ) -> Result<NodeCanvasGrid>
pub fn pan(&mut self, delta_screen: [f32; 2]) -> Result<()>
pub fn zoom_at(&mut self, factor: f32, focus_screen: [f32; 2]) -> Result<()>
pub fn fit_to_view( &mut self, bounds: &WorldAabb, padding_pixels: f32, ) -> Result<()>
pub fn step_animation(&mut self, delta_ms: f32) -> Result<()>
fn clone(&self) -> NodeCanvas
fn fmt(&self, f: &mut Formatter<'_>) -> Result

Associated Functions

pub fn new() -> Self
fn default() -> NodeCanvas

Public Method Documentation

pub const fn state( &self ) -> &NodeCanvasState
No public source comment is attached to this declaration.
pub const fn is_animating( &self ) -> bool
No public source comment is attached to this declaration.
pub fn set_state(&mut self, state: NodeCanvasState) -> Result<()>
No public source comment is attached to this declaration.
pub fn set_view_size(&mut self, w: f32, h: f32) -> Result<()>
No public source comment is attached to this declaration.
pub fn world_to_screen( &self, world: [f32; 2] ) -> [f32; 2]
No public source comment is attached to this declaration.
pub fn screen_to_world( &self, screen: [f32; 2] ) -> [f32; 2]
No public source comment is attached to this declaration.
pub fn visible_world_rect( &self ) -> WorldAabb
No public source comment is attached to this declaration.
pub fn hit_test( &self, screen: [f32; 2], items: &[NodeCanvasHitItem] ) -> Result<Option<NodeCanvasHit>>
No public source comment is attached to this declaration.
pub fn grid( &self, minimum_screen_spacing: f32, base_world_step: f32, major_every: u32, super_major_every: u32 ) -> Result<NodeCanvasGrid>
No public source comment is attached to this declaration.
pub fn pan(&mut self, delta_screen: [f32; 2]) -> Result<()>
No public source comment is attached to this declaration.
pub fn zoom_at(&mut self, factor: f32, focus_screen: [f32; 2]) -> Result<()>
No public source comment is attached to this declaration.
pub fn fit_to_view( &mut self, bounds: &WorldAabb, padding_pixels: f32, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn step_animation(&mut self, delta_ms: f32) -> Result<()>
No public source comment is attached to this declaration.
fn clone( &self ) -> NodeCanvas
No public source comment is attached to this declaration.
fn fmt( &self, f: &mut Formatter<'_> ) -> Result
No public source comment is attached to this declaration.
pub fn new() -> Self
Access the current canvas state.
fn default() -> NodeCanvas
No public source comment is attached to this declaration.