pub struct NodeEditorSetup<F>{ /* private fields */ }Expand description
Setup helper that bundles NodeEditorController and automatic model updates.
This helper eliminates boilerplate by:
- Managing the controller lifecycle
- Calling your drag-commit closure automatically when a drag ends
The setup knows nothing about selection. A finished drag hands your closure
the node that was dragged, and committing it — including moving whatever
else is selected — is GraphLogic::commit_drag, which reads selected
off the model rows.
Implementations§
Source§impl<F> NodeEditorSetup<F>
impl<F> NodeEditorSetup<F>
Sourcepub fn new(on_drag_committed: F) -> Self
pub fn new(on_drag_committed: F) -> Self
Create a new setup helper with a drag-commit callback.
The callback receives (dragged_node_id, delta_x, delta_y) once, when a
node drag ends. This is the ONLY callback you need to provide - everything
else is handled internally.
Sourcepub fn controller(&self) -> &Rc<NodeEditorController>
pub fn controller(&self) -> &Rc<NodeEditorController>
Get the underlying controller for advanced operations.
Sourcepub fn report_node_rect(&self) -> impl Fn(i32, f32, f32, f32, f32) + 'static
pub fn report_node_rect(&self) -> impl Fn(i32, f32, f32, f32, f32) + 'static
Callback for NodeEditorInternalCallbacks.on_report_node_rect.
Sourcepub fn report_pin_position(
&self,
) -> impl Fn(i32, i32, i32, f32, f32, bool) + 'static
pub fn report_pin_position( &self, ) -> impl Fn(i32, i32, i32, f32, f32, bool) + 'static
Callback for NodeEditorInternalCallbacks.on_report_pin_position.
Sourcepub fn remove_node(&self) -> impl Fn(i32) + 'static
pub fn remove_node(&self) -> impl Fn(i32) + 'static
Callback for retiring a node and all of its projected pins.
Sourcepub fn remove_pin(&self) -> impl Fn(i32) + 'static
pub fn remove_pin(&self) -> impl Fn(i32) + 'static
Callback for retiring one projected pin.
Sourcepub fn reset_graph(&self) -> impl Fn() + 'static
pub fn reset_graph(&self) -> impl Fn() + 'static
Callback for clearing all projected graph state.
Sourcepub fn start_node_drag(&self) -> impl Fn(i32, bool, f32, f32) + 'static
pub fn start_node_drag(&self) -> impl Fn(i32, bool, f32, f32) + 'static
Callback for NodeEditorInternalCallbacks.on_start_node_drag.
Sourcepub fn cancel_node_drag(&self) -> impl Fn() + 'static
pub fn cancel_node_drag(&self) -> impl Fn() + 'static
Callback for a node drag cancelled before its normal end.