use crate::{Env, NodeCtx, NodeUi, NodeUiResponse, SocketDoc, SocketKind};
impl NodeUi for gantz_core::node::Delay {
fn name(&self, _: &Env<'_>) -> std::borrow::Cow<'_, str> {
"delay".into()
}
fn description(&self) -> Option<&'static str> {
Some("Output the previous evaluation's value")
}
fn ui(&mut self, _ctx: NodeCtx, uictx: egui_graph::NodeCtx) -> NodeUiResponse {
let framed =
uictx.framed(|ui, _sockets| ui.add(egui::Label::new("delay").selectable(false)));
NodeUiResponse::new(framed)
}
fn socket_doc(&self, _: &Env<'_>, kind: SocketKind, _ix: usize) -> Option<SocketDoc> {
Some(match kind {
SocketKind::Input => {
SocketDoc::ty("any").with_description("value stored for the next evaluation")
}
SocketKind::Output => SocketDoc::ty("any").with_description(
"value from the previous evaluation (initially '()); enables feedback cycles",
),
})
}
}