use super::{
transform::WorldPos,
viewer::{Link, NodeId, PortAddr, StackId},
};
#[derive(Debug, Clone)]
pub enum GraphAction {
NodeMoved {
node: NodeId,
from: WorldPos,
to: WorldPos,
},
StackMoved {
stack: StackId,
from: WorldPos,
to: WorldPos,
},
StackMemberMoved {
stack: StackId,
from_index: usize,
to_index: usize,
},
SelectionChanged,
LinkRequested { from: PortAddr, to: PortAddr },
LinkDeleteRequested { link: Link },
NodesDeleteRequested { nodes: Vec<NodeId> },
StacksDeleteRequested { stacks: Vec<StackId> },
StackAddRequested { stack: StackId },
ContextMenu { at: WorldPos },
LinkDropped {
source: PortAddr,
source_is_output: bool,
at: WorldPos,
},
}
#[derive(Debug, Clone, Copy)]
pub struct ChipHit {
pub port: PortAddr,
pub rect: egui::Rect,
pub font_size: f32,
pub pad: f32,
pub clip: egui::Rect,
pub chevron: Option<egui::Rect>,
pub expanded: bool,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ExternalDropTarget {
Input(PortAddr),
Node(NodeId),
Canvas(WorldPos),
}
pub struct GraphResponse {
#[allow(dead_code)]
pub response: egui::Response,
pub hovered_node: Option<NodeId>,
pub external_drop_target: Option<ExternalDropTarget>,
pub actions: Vec<GraphAction>,
}