|
1 |
| -use super::algorithms::intersection::filtered_segment_intersections; |
| 1 | +use super::algorithms::{bezpath_algorithms::bezpath_is_inside_bezpath, intersection::filtered_segment_intersections}; |
2 | 2 | use super::misc::dvec2_to_point;
|
3 | 3 | use crate::math::math_ext::QuadExt;
|
4 | 4 | use crate::math::quad::Quad;
|
5 | 5 | use crate::subpath::Subpath;
|
6 | 6 | use crate::vector::PointId;
|
7 | 7 | use crate::vector::misc::point_to_dvec2;
|
8 | 8 | use glam::{DAffine2, DMat2, DVec2};
|
9 |
| -use kurbo::{Affine, ParamCurve, PathSeg, Point, Shape}; |
| 9 | +use kurbo::{Affine, BezPath, ParamCurve, PathSeg, Shape}; |
10 | 10 |
|
11 | 11 | #[derive(Copy, Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
|
12 | 12 | pub struct FreePoint {
|
@@ -125,9 +125,11 @@ impl ClickTarget {
|
125 | 125 | return true;
|
126 | 126 | }
|
127 | 127 |
|
| 128 | + let mut selection = BezPath::from_path_segments(bezier_iter()); |
| 129 | + selection.close_path(); |
| 130 | + |
128 | 131 | // Check if shape is entirely within selection
|
129 |
| - let any_point_from_subpath = subpath.manipulator_groups().first().map(|manipulators| manipulators.anchor); |
130 |
| - any_point_from_subpath.is_some_and(|shape_point| bezier_iter().map(|bezier| bezier.winding(Point::new(shape_point.x, shape_point.y))).sum::<i32>() != 0) |
| 132 | + bezpath_is_inside_bezpath(&subpath.to_bezpath(), &selection, None, None) |
131 | 133 | }
|
132 | 134 | ClickTargetType::FreePoint(point) => bezier_iter().map(|bezier: PathSeg| bezier.winding(dvec2_to_point(point.position))).sum::<i32>() != 0,
|
133 | 135 | }
|
|
0 commit comments