diff options
Diffstat (limited to 'source/blender/editors/mask/mask_ops.c')
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index d322ca931b9..486704c9b9e 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -510,6 +510,7 @@ static bool spline_under_mouse_get(const bContext *C, MaskLayer **mask_layer_r, MaskSpline **mask_spline_r) { + const float threshold = 19.0f; ScrArea *sa = CTX_wm_area(C); SpaceClip *sc = CTX_wm_space_clip(C); MaskLayer *mask_layer; @@ -580,10 +581,17 @@ static bool spline_under_mouse_get(const bContext *C, } } } - /* TODO(sergey): Chech whether tessellated spline point is closer - * to the mouse than the spline center. - */ - if (closest_dist_squared < SQUARE(32.0f) && closest_spline != NULL) { + if (closest_dist_squared < SQUARE(threshold) && closest_spline != NULL) { + float diff_score; + if (ED_mask_find_nearest_diff_point(C, mask, co, threshold, false, + NULL, NULL, NULL, NULL, + NULL, true, false, &diff_score)) + { + if (SQUARE(diff_score) < closest_dist_squared) { + return false; + } + } + *mask_layer_r = closest_layer; *mask_spline_r = closest_spline; return true; @@ -1185,7 +1193,7 @@ static bool slide_spline_curvature_check(bContext *C, const wmEvent *event) static SlideSplineCurvatureData *slide_spline_curvature_customdata( bContext *C, const wmEvent *event) { - const float threshold = 19; + const float threshold = 19.0f; Mask *mask = CTX_data_edit_mask(C); SlideSplineCurvatureData *slide_data; @@ -1199,7 +1207,7 @@ static SlideSplineCurvatureData *slide_spline_curvature_customdata( if (!ED_mask_find_nearest_diff_point(C, mask, co, threshold, false, &mask_layer, &spline, &point, &u, - NULL, true, false)) + NULL, true, false, NULL)) { return NULL; } |