Skip to main content

jellyflow_runtime/runtime/conformance/scenario/action/
selection.rs

1use crate::io::NodeGraphKeyCode;
2use crate::runtime::selection::SelectionBoxInput;
3use keyboard_types::Code as KeyCode;
4
5use super::ConformanceAction;
6
7pub(super) fn kind(action: &ConformanceAction) -> Option<&'static str> {
8    Some(match action {
9        ConformanceAction::ApplySelectionBox { .. } => "apply_selection_box",
10        ConformanceAction::ApplyDeleteSelection => "apply_delete_selection",
11        ConformanceAction::ApplyDeleteSelectionForKey { .. } => "apply_delete_selection_for_key",
12        _ => return None,
13    })
14}
15
16impl ConformanceAction {
17    pub fn apply_selection_box(input: SelectionBoxInput) -> Self {
18        Self::ApplySelectionBox { input }
19    }
20
21    pub fn apply_delete_selection() -> Self {
22        Self::ApplyDeleteSelection
23    }
24
25    pub fn apply_delete_selection_for_key(key: KeyCode) -> Self {
26        Self::ApplyDeleteSelectionForKey {
27            key: NodeGraphKeyCode(key),
28        }
29    }
30}