Fix editor crash when anchor sliding, followup to #2682 (#2726)

Fix editor crash due to unwrap
This commit is contained in:
Adesh Gupta 2025-06-18 14:06:32 +05:30 committed by Keavon Chambers
parent e238753a35
commit 579bedd9ff
1 changed files with 11 additions and 8 deletions

View File

@ -2261,14 +2261,17 @@ fn update_dynamic_hints(state: PathToolFsmState, responses: &mut VecDeque<Messag
let at_least_one_anchor_selected = shape_editor.selected_points().any(|point| matches!(point, ManipulatorPointId::Anchor(_))); let at_least_one_anchor_selected = shape_editor.selected_points().any(|point| matches!(point, ManipulatorPointId::Anchor(_)));
let at_least_one_point_selected = shape_editor.selected_points().count() >= 1; let at_least_one_point_selected = shape_editor.selected_points().count() >= 1;
let single_colinear_anchor_selected = if single_anchor_selected { let mut single_colinear_anchor_selected = false;
let anchor = shape_editor.selected_points().next().unwrap(); if single_anchor_selected {
let layer = document.network_interface.selected_nodes().selected_layers(document.metadata()).next().unwrap(); if let (Some(anchor), Some(layer)) = (
let vector_data = document.network_interface.compute_modified_vector(layer).unwrap(); shape_editor.selected_points().next(),
vector_data.colinear(*anchor) document.network_interface.selected_nodes().selected_layers(document.metadata()).next(),
} else { ) {
false if let Some(vector_data) = document.network_interface.compute_modified_vector(layer) {
}; single_colinear_anchor_selected = vector_data.colinear(*anchor)
}
}
}
let mut drag_selected_hints = vec![HintInfo::mouse(MouseMotion::LmbDrag, "Drag Selected")]; let mut drag_selected_hints = vec![HintInfo::mouse(MouseMotion::LmbDrag, "Drag Selected")];
let mut delete_selected_hints = vec![HintInfo::keys([Key::Delete], "Delete Selected")]; let mut delete_selected_hints = vec![HintInfo::keys([Key::Delete], "Delete Selected")];