Add 'select all points' method to ShapeState struct (#1386)

* Added select all points method to ShapeState struct

* Map select_all_points functions to shortcut

* Make SelectAllPoints action relevant in the current context only

* Refactor select_all_points to only select anchors

* Fix(editor): enable selected point update after selection change via clicking
This commit is contained in:
Prikshit Gautam
2023-09-04 19:35:43 -07:00
committed by GitHub
parent 56f20f2e6d
commit ad9ccaa800
3 changed files with 26 additions and 1 deletions
@@ -106,6 +106,20 @@ impl ShapeState {
None
}
pub fn select_all_points(&mut self, document: &Document) {
for (layer_path, selected_layer_state) in self.selected_shape_state.iter_mut() {
let Ok(layer) = document.layer(layer_path) else { continue };
let Some(vector_data) = layer.as_vector_data() else { continue };
for group in vector_data.manipulator_groups() {
selected_layer_state.select_point(ManipulatorPointId::new(group.id, SelectedType::Anchor));
for selected_type in &[SelectedType::InHandle, SelectedType::OutHandle] {
selected_layer_state.deselect_point(ManipulatorPointId::new(group.id, *selected_type));
}
}
}
}
pub fn deselect_all(&mut self) {
self.selected_shape_state.values_mut().for_each(|state| state.selected_points.clear());
}