Fix freehand and spline tool

This commit is contained in:
0hypercube
2023-10-17 11:02:06 -07:00
committed by Keavon Chambers
parent 76d7b6256d
commit 6173662a40
15 changed files with 89 additions and 85 deletions
@@ -28,7 +28,7 @@ pub fn new_custom_layer(network: NodeNetwork, layer_path: Vec<LayerId>, response
responses.add(DocumentMessage::InputFrameRasterizeRegionBelowLayer { layer_path });
}
pub fn set_manipulator_mirror_angle(manipulator_groups: &Vec<ManipulatorGroup<ManipulatorGroupId>>, layer_path: &[u64], mirror_angle: bool, responses: &mut VecDeque<Message>) {
pub fn set_manipulator_mirror_angle(manipulator_groups: &[ManipulatorGroup<ManipulatorGroupId>], layer_path: &[u64], mirror_angle: bool, responses: &mut VecDeque<Message>) {
for manipulator_group in manipulator_groups {
responses.add(GraphOperationMessage::Vector {
layer: layer_path.to_owned(),
@@ -153,7 +153,7 @@ impl ShapeState {
// Sets the selected points to all points for the corresponding intersection
pub fn select_all_anchors(&mut self, document: &Document, layer: LayerNodeIdentifier) {
let Some(subpaths) = get_subpaths(layer, document) else { return };
let Some(subpaths) = get_subpaths(layer, document) else { return };
let Some(state) = self.selected_shape_state.get_mut(&layer) else { return };
for manipulator in get_manipulator_groups(subpaths) {
state.select_point(ManipulatorPointId::new(manipulator.id, SelectedType::Anchor))
@@ -375,7 +375,7 @@ impl ShapeState {
continue;
}
let Some(group) =get_manipulator_from_id(subpaths,point.group) else { continue };
let Some(group) = get_manipulator_from_id(subpaths, point.group) else { continue };
let mut move_point = |point: ManipulatorPointId| {
let Some(previous_position) = point.manipulator_type.get_position(group) else { return };
@@ -430,7 +430,7 @@ impl ShapeState {
/// Delete selected and mirrored handles with zero length when the drag stops.
pub fn delete_selected_handles_with_zero_length(&self, document: &Document, opposing_handle_lengths: &Option<OpposingHandleLengths>, responses: &mut VecDeque<Message>) {
for (&layer, state) in &self.selected_shape_state {
let Some(subpaths) = get_subpaths(layer, document) else { continue };
let Some(subpaths) = get_subpaths(layer, document) else { continue };
let Some(mirror_angle) = get_mirror_handles(layer, document) else { continue };
let opposing_handle_lengths = opposing_handle_lengths.as_ref().and_then(|lengths| lengths.get(&layer));
@@ -443,7 +443,7 @@ impl ShapeState {
continue;
}
let Some(group) = get_manipulator_from_id(subpaths,point.group) else { continue };
let Some(group) = get_manipulator_from_id(subpaths, point.group) else { continue };
let anchor_position = transform.transform_point2(group.anchor);
@@ -521,7 +521,7 @@ impl ShapeState {
/// Reset the opposing handle lengths.
pub fn reset_opposing_handle_lengths(&self, document: &Document, opposing_handle_lengths: &OpposingHandleLengths, responses: &mut VecDeque<Message>) {
for (&layer, state) in &self.selected_shape_state {
let Some(subpaths) = get_subpaths(layer, document) else { continue };
let Some(subpaths) = get_subpaths(layer, document) else { continue };
let Some(mirror_angle) = get_mirror_handles(layer, document) else { continue };
let Some(opposing_handle_lengths) = opposing_handle_lengths.get(&layer) else { continue };