mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user