Improve Pen tool handle dragging with Tab swapping, Ctrl angle locking, and directly dragging the closing endpoint in handle (#2452)

* added handle_types and refactored the handle_adjustments

* anchor move refactor

* code-todo-fix

* removed-draw-mode

* kind of works need to figure out snapping

* some refactoring

* refactor+overlays..need to fix the snapping and dragging

* added docs

* got stuck in space move

* fixed all issues

* comments and small fixes

* completed last issue and refactor

* major fixes and improv

* fixed edge cases

* edge cases fixed

* fix edge cases and add docs

* Code review pass

* rename ,bug fixes

* Add terminology diagram

* Add Ctrl "Lock Angle" hint

* Rename other hint

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0SlowPoke0 2025-04-08 11:56:51 +05:30 committed by GitHub
parent 32aee1ebf9
commit 6a8386d1e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 602 additions and 276 deletions

View file

@ -254,6 +254,7 @@ pub fn input_mappings() -> Mapping {
//
// PenToolMessage
entry!(PointerMove; refresh_keys=[Control, Alt, Shift, KeyC], action_dispatch=PenToolMessage::PointerMove { snap_angle: Shift, break_handle: Alt, lock_angle: Control, colinear: KeyC, move_anchor_with_handles: Space }),
entry!(KeyDownNoRepeat(Tab); action_dispatch=PenToolMessage::SwapHandles),
entry!(KeyDown(MouseLeft); action_dispatch=PenToolMessage::DragStart { append_to_selected: Shift }),
entry!(KeyUp(MouseLeft); action_dispatch=PenToolMessage::DragStop),
entry!(KeyDown(MouseRight); action_dispatch=PenToolMessage::Abort),

View file

@ -1468,7 +1468,7 @@ impl Fsm for PathToolFsmState {
let drag_anchor = HintInfo::keys([Key::Space], "Drag Anchor");
let toggle_group = match dragging_state.point_select_state {
PointSelectState::HandleNoPair | PointSelectState::HandleWithPair => {
let mut hints = vec![HintInfo::keys([Key::Tab], "Swap Selected Handles")];
let mut hints = vec![HintInfo::keys([Key::Tab], "Swap Dragged Handle")];
hints.push(HintInfo::keys(
[Key::KeyC],
if colinear == ManipulatorAngle::Colinear {

File diff suppressed because it is too large Load diff

View file

@ -334,14 +334,22 @@ impl VectorData {
let (start_point_id, _, _) = self.segment_points_from_id(*segment_id)?;
let start_index = self.point_domain.resolve_id(start_point_id)?;
self.segment_domain.end_connected(start_index).find(|&id| id != *segment_id).map(|id| (start_point_id, id))
self.segment_domain.end_connected(start_index).find(|&id| id != *segment_id).map(|id| (start_point_id, id)).or(self
.segment_domain
.start_connected(start_index)
.find(|&id| id != *segment_id)
.map(|id| (start_point_id, id)))
}
ManipulatorPointId::EndHandle(segment_id) => {
// For end handle, find segments starting at our end point
let (_, end_point_id, _) = self.segment_points_from_id(*segment_id)?;
let end_index = self.point_domain.resolve_id(end_point_id)?;
self.segment_domain.start_connected(end_index).find(|&id| id != *segment_id).map(|id| (end_point_id, id))
self.segment_domain.start_connected(end_index).find(|&id| id != *segment_id).map(|id| (end_point_id, id)).or(self
.segment_domain
.end_connected(end_index)
.find(|&id| id != *segment_id)
.map(|id| (end_point_id, id)))
}
ManipulatorPointId::Anchor(_) => None,
}