Snapping improvements (#1567)

This commit is contained in:
0HyperCube
2024-01-13 08:10:24 -08:00
committed by GitHub
parent 456ca170a4
commit bf0ec2c9c8
5 changed files with 34 additions and 6 deletions
@@ -64,9 +64,9 @@ pub fn snap_tolerance(document: &DocumentMessageHandler) -> f64 {
}
fn compare_points(a: &&SnappedPoint, b: &&SnappedPoint) -> Ordering {
if (a.target.bounding_box() && !b.target.bounding_box()) || (a.at_intersection && !b.at_intersection) {
if (a.target.bounding_box() && !b.target.bounding_box()) || (a.at_intersection && !b.at_intersection) || (a.source.bounding_box() && !b.source.bounding_box()) {
Ordering::Greater
} else if (!a.target.bounding_box() && b.target.bounding_box()) || (!a.at_intersection && b.at_intersection) {
} else if (!a.target.bounding_box() && b.target.bounding_box()) || (!a.at_intersection && b.at_intersection) || (!a.source.bounding_box() && b.source.bounding_box()) {
Ordering::Less
} else {
a.distance.partial_cmp(&b.distance).unwrap()