Add Path tool support for Alt-dragging an anchor to pull out a fresh equidistant handle pair (#2496)

* Added initial logic for dragging

* Alt drag stop makes opposite handle back to its position

* Implement new requested behaviour

* Fix sharp point bug

* Apply suggestions from code review

* Add hints

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Adesh Gupta
2025-04-17 06:05:45 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent fa21385d2c
commit ab39f3f837
3 changed files with 123 additions and 13 deletions
@@ -742,6 +742,7 @@ impl ShapeState {
delta: DVec2,
equidistant: bool,
in_viewport_space: bool,
was_alt_dragging: bool,
opposite_handle_position: Option<DVec2>,
responses: &mut VecDeque<Message>,
) {
@@ -810,9 +811,11 @@ impl ShapeState {
let length = opposing_handle.copied().unwrap_or_else(|| transform.transform_vector2(other_position - anchor_position).length());
direction.map_or(other_position - anchor_position, |direction| transform.inverse().transform_vector2(-direction * length))
};
let modification_type = other.set_relative_position(new_relative);
responses.add(GraphOperationMessage::Vector { layer, modification_type });
if !was_alt_dragging {
let modification_type = other.set_relative_position(new_relative);
responses.add(GraphOperationMessage::Vector { layer, modification_type });
}
}
}
}