mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 00:48:13 +08:00
Added fine-grained choices to Snapping options popover (#1730)
* Added Customised Snapping * Fix snapping choice to Anchors; clean up popover menu code --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
3019cc7253
commit
67ba5bcecf
@@ -278,9 +278,9 @@ impl ShapeState {
|
||||
let source = if handle.is_handle() {
|
||||
SnapSource::Geometry(GeometrySnapSource::Handle)
|
||||
} else if are_manipulator_handles_colinear(group, to_document, subpath, index) {
|
||||
SnapSource::Geometry(GeometrySnapSource::HandlesColinear)
|
||||
SnapSource::Geometry(GeometrySnapSource::AnchorWithColinearHandles)
|
||||
} else {
|
||||
SnapSource::Geometry(GeometrySnapSource::HandlesFree)
|
||||
SnapSource::Geometry(GeometrySnapSource::AnchorWithFreeHandles)
|
||||
};
|
||||
let Some(position) = handle.get_position(group) else { continue };
|
||||
let mut point = SnapCandidatePoint::new_source(to_document.transform_point2(position) + mouse_delta, source);
|
||||
|
||||
@@ -327,10 +327,10 @@ impl SnapCandidatePoint {
|
||||
Self::new(document_point, source, SnapTarget::None)
|
||||
}
|
||||
pub fn handle(document_point: DVec2) -> Self {
|
||||
Self::new_source(document_point, SnapSource::Geometry(GeometrySnapSource::HandlesFree))
|
||||
Self::new_source(document_point, SnapSource::Geometry(GeometrySnapSource::AnchorWithFreeHandles))
|
||||
}
|
||||
pub fn handle_neighbors(document_point: DVec2, neighbors: impl Into<Vec<DVec2>>) -> Self {
|
||||
let mut point = Self::new_source(document_point, SnapSource::Geometry(GeometrySnapSource::HandlesFree));
|
||||
let mut point = Self::new_source(document_point, SnapSource::Geometry(GeometrySnapSource::AnchorWithFreeHandles));
|
||||
point.neighbors = neighbors.into();
|
||||
point
|
||||
}
|
||||
@@ -401,19 +401,19 @@ fn subpath_anchor_snap_points(layer: LayerNodeIdentifier, subpath: &Subpath<Poin
|
||||
|
||||
let colinear = are_manipulator_handles_colinear(group, to_document, subpath, index);
|
||||
|
||||
if colinear && document.snapping_state.target_enabled(SnapTarget::Geometry(GeometrySnapTarget::HandlesColinear)) {
|
||||
if colinear && document.snapping_state.target_enabled(SnapTarget::Geometry(GeometrySnapTarget::AnchorWithColinearHandles)) {
|
||||
// Colinear handles
|
||||
points.push(SnapCandidatePoint::new(
|
||||
to_document.transform_point2(group.anchor),
|
||||
SnapSource::Geometry(GeometrySnapSource::HandlesColinear),
|
||||
SnapTarget::Geometry(GeometrySnapTarget::HandlesColinear),
|
||||
SnapSource::Geometry(GeometrySnapSource::AnchorWithColinearHandles),
|
||||
SnapTarget::Geometry(GeometrySnapTarget::AnchorWithColinearHandles),
|
||||
));
|
||||
} else if !colinear && document.snapping_state.target_enabled(SnapTarget::Geometry(GeometrySnapTarget::HandlesFree)) {
|
||||
} else if !colinear && document.snapping_state.target_enabled(SnapTarget::Geometry(GeometrySnapTarget::AnchorWithFreeHandles)) {
|
||||
// Free handles
|
||||
points.push(SnapCandidatePoint::new(
|
||||
to_document.transform_point2(group.anchor),
|
||||
SnapSource::Geometry(GeometrySnapSource::HandlesFree),
|
||||
SnapTarget::Geometry(GeometrySnapTarget::HandlesFree),
|
||||
SnapSource::Geometry(GeometrySnapSource::AnchorWithFreeHandles),
|
||||
SnapTarget::Geometry(GeometrySnapTarget::AnchorWithFreeHandles),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user