diff --git a/src/ui.rs b/src/ui.rs index cb5e1af..04f510c 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1597,6 +1597,10 @@ impl Snarl { let mut new_pins_size = Vec2::ZERO; let r = node_frame.show(node_ui, |ui| { + if viewer.has_node_style(node, &inputs, &outputs, self) { + viewer.apply_node_style(ui.style_mut(), node, &inputs, &outputs, self); + } + let min_pin_y = node_state.header_height().mul_add(0.5, node_rect.min.y); // Input pins' center side by X axis. diff --git a/src/ui/viewer.rs b/src/ui/viewer.rs index ec37d81..8fc5543 100644 --- a/src/ui/viewer.rs +++ b/src/ui/viewer.rs @@ -37,6 +37,30 @@ pub trait SnarlViewer { let _ = (node, inputs, outputs, snarl); default } + /// Checks if node has a custom egui style. + #[inline] + fn has_node_style( + &mut self, + node: NodeId, + inputs: &[InPin], + outputs: &[OutPin], + snarl: &Snarl, + ) -> bool { + let _ = (node, inputs, outputs, snarl); + false + } + + /// Modifies the node's egui style + fn apply_node_style( + &mut self, + style: &mut Style, + node: NodeId, + inputs: &[InPin], + outputs: &[OutPin], + snarl: &Snarl, + ) { + let _ = (style, node, inputs, outputs, snarl); + } /// Returns layout override for the node. ///