Skip to main content

wire_node_editor

Macro wire_node_editor 

Source
macro_rules! wire_node_editor {
    ($window:expr, $setup:expr) => { ... };
}
Expand description

Wire up all NodeEditor callbacks with a single macro call.

This macro sets up default behavior for geometry tracking, computations, grid updates, and keyboard focus on editor presses. You can override any callback after calling this macro - the last .on_*() call wins.

The window must expose grid-commands, width_, height_, and public function focus-editor() { editor.focus(); }.

ยงGenerated-UI integration

This fragment assumes the generated globals and window members from the compiled quick start.

use slint_node_editor::{NodeEditorSetup, wire_node_editor};

let setup = NodeEditorSetup::new(|node_id, dx, dy| {
    // Update your model
});

wire_node_editor!(window, setup);

// Override specific callbacks if needed:
// window.global::<NodeEditorComputations>().on_compute_pin_at(|x, y, radius| { ... });