Add Pen and Path tool modes to avoid showing all handles (#2264)

* Path tool only show frontier overlays

* Implemented all modes for pen and path tool

* Fixed formatting issue

* Changes in selection behaviour of handles

* Selection toggle only on drag not click

* Changed comment

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Adesh Gupta
2025-02-12 15:00:15 +05:30
committed by GitHub
parent 1700c3a650
commit 20a5f71bda
5 changed files with 347 additions and 47 deletions

View File

@@ -293,6 +293,26 @@ impl VectorData {
None
}
}
pub fn adjacent_segment(&self, manipulator_id: &ManipulatorPointId) -> Option<(PointId, SegmentId)> {
match manipulator_id {
ManipulatorPointId::PrimaryHandle(segment_id) => {
// For start handle, find segments ending at our start point
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))
}
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))
}
ManipulatorPointId::Anchor(_) => None,
}
}
}
impl Default for VectorData {