Skip to main content

NodeEditorSetup

Struct NodeEditorSetup 

Source
pub struct NodeEditorSetup<F>
where F: Fn(i32, f32, f32) + 'static,
{ /* 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 NodeEditorSetup<Box<dyn Fn(i32, f32, f32)>>

Source

pub fn with_drag_commit( on_committed: impl Fn(Dragged, f32, f32) + 'static, ) -> Self

Create a setup helper with one drag commit for both gestures.

The closure receives what was dragged (Dragged::Node or Dragged::Group) and the delta, once per finished drag. With GroupLogic::commit_drag it is the whole movement policy for a host with groups:

let setup = NodeEditorSetup::with_drag_commit(move |dragged, dx, dy| {
    GroupLogic::commit_drag(&nodes, &groups, dragged, dx, dy)
});
Source§

impl<F> NodeEditorSetup<F>
where F: Fn(i32, f32, f32) + 'static,

Source

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.

Source

pub fn on_group_drag_committed( &self, on_committed: impl Fn(i32, f32, f32) + 'static, )

Install the commit for a finished group sheet drag, when the node and group commits are separate closures. Self::with_drag_commit is the usual way to get both from one rule.

Source

pub fn controller(&self) -> &Rc<NodeEditorController>

Get the underlying controller for advanced operations.

Source

pub fn report_node_rect(&self) -> impl Fn(i32, f32, f32, f32, f32) + 'static

Callback for NodeEditorInternalCallbacks.on_report_node_rect.

Source

pub fn report_pin_position( &self, ) -> impl Fn(i32, i32, i32, f32, f32, bool) + 'static

Callback for NodeEditorInternalCallbacks.on_report_pin_position.

Source

pub fn remove_node(&self) -> impl Fn(i32) + 'static

Callback for retiring a node and all of its projected pins.

Source

pub fn remove_pin(&self) -> impl Fn(i32) + 'static

Callback for retiring one projected pin.

Source

pub fn reset_graph(&self) -> impl Fn() + 'static

Callback for clearing all projected graph state.

Source

pub fn start_node_drag(&self) -> impl Fn(i32, bool, f32, f32) + 'static

Callback for NodeEditorInternalCallbacks.on_start_node_drag.

Source

pub fn cancel_node_drag(&self) -> impl Fn() + 'static

Callback for a node drag cancelled before its normal end.

Source

pub fn end_node_drag(&self) -> impl Fn(i32, f32, f32) + 'static

Callback for NodeEditorInternalCallbacks.on_end_node_drag.

Calls your drag-commit closure once, with the node the user dragged.

Source

pub fn report_group_rect(&self) -> impl Fn(i32, f32, f32, f32, f32) + 'static

Callback for NodeEditorInternalCallbacks.on_report_group_rect.

Source

pub fn remove_group(&self) -> impl Fn(i32) + 'static

Callback for retiring a group sheet’s projected rectangle.

Source

pub fn set_node_hidden(&self) -> impl Fn(i32, bool) + 'static

Callback for NodeEditorInternalCallbacks.on_set_node_hidden.

Source

pub fn start_group_drag(&self) -> impl Fn(i32, f32, f32) + 'static

Callback for NodeEditorInternalCallbacks.on_start_group_drag.

Source

pub fn end_group_drag(&self) -> impl Fn(i32, f32, f32) + 'static

Callback for NodeEditorInternalCallbacks.on_end_group_drag.

Calls the group drag commit from Self::with_drag_commit or Self::on_group_drag_committed, if any, once per finished sheet drag.

Auto Trait Implementations§

§

impl<F> !RefUnwindSafe for NodeEditorSetup<F>

§

impl<F> !Send for NodeEditorSetup<F>

§

impl<F> !Sync for NodeEditorSetup<F>

§

impl<F> !UnwindSafe for NodeEditorSetup<F>

§

impl<F> Freeze for NodeEditorSetup<F>
where Rc<F>: Freeze,

§

impl<F> Unpin for NodeEditorSetup<F>
where Rc<F>: Unpin,

§

impl<F> UnsafeUnpin for NodeEditorSetup<F>
where Rc<F>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.