use jellyflow_core::core::CanvasPoint;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct NodeDragActivationInput {
pub screen_delta: CanvasPoint,
pub threshold: f32,
}
impl NodeDragActivationInput {
pub fn new(screen_delta: CanvasPoint, threshold: f32) -> Self {
Self {
screen_delta,
threshold,
}
}
}
pub fn node_drag_threshold_met(input: NodeDragActivationInput) -> bool {
if !input.screen_delta.is_finite() {
return false;
}
if input.threshold == 0.0 {
return true;
}
if !input.threshold.is_finite() {
return false;
}
input.screen_delta.x.hypot(input.screen_delta.y) > input.threshold
}