UI: Increase Gizmo 3D Part Hit Size For Pens

Gizmos that contain 3D parts, like the rounded lines of the "Rotate"
gizmo, have a fairly small hit size that make it hard to grab with a
tablet pen. This PR just increases the radius around the pointer
position while using a pen.

Pull Request: https://projects.blender.org/blender/blender/pulls/136847
This commit is contained in:
Harley Acheson
2025-04-10 18:38:23 +02:00
committed by Harley Acheson
parent 4c38327ea2
commit a043a0e74d

View File

@@ -716,10 +716,19 @@ static wmGizmo *gizmo_find_intersected_3d(bContext *C,
});
GPU_framebuffer_bind(depth_read_fb);
const wmWindow *win = CTX_wm_window(C);
/* How much this gizmo is bigger or smaller than default. */
const float gizmo_ratio = float(U.gizmo_size) / 75.0f;
/* Wider test area for tablet pens. */
const int test_min = ((win->event_last_handled->tablet.active) ? 6.0f : 4.0f) * UI_SCALE_FAC *
gizmo_ratio;
const int test_max = ((win->event_last_handled->tablet.active) ? 12.0f : 10.0f) *
UI_SCALE_FAC * gizmo_ratio;
const int hotspot_radii[] = {
int(3 * U.pixelsize),
test_min,
/* This runs on mouse move, careful doing too many tests! */
int(10 * U.pixelsize),
test_max,
};
for (int i = 0; i < ARRAY_SIZE(hotspot_radii); i++) {
hit = gizmo_find_intersected_3d_intern(