Gizmo: Support translation without cross drawing

Add an enum entry `ED_GIZMO_CAGE_DRAW_FLAG_NOP` to be able to set enums
explicitly to draw no handles.
The current code already supports this case implicitly.

See https://projects.blender.org/blender/blender/pulls/139107 for an
example use case.

Pull Request: https://projects.blender.org/blender/blender/pulls/139210
This commit is contained in:
Habib Gahbiche
2025-05-22 10:54:18 +02:00
parent 16aee8efff
commit 5e12caba08
2 changed files with 5 additions and 0 deletions

View File

@@ -953,6 +953,10 @@ static int gizmo_cage2d_test_select(bContext *C, wmGizmo *gz, const int mval[2])
r.ymin = -size[1] + margin[1];
r.xmax = size[0] - margin[0];
r.ymax = size[1] - margin[1];
if (!BLI_rctf_is_valid(&r)) {
/* Typically happens when gizmo width or height is very small. */
BLI_rctf_sanitize(&r);
}
}
bool isect = BLI_rctf_isect_pt_v(&r, point_local);
if (isect) {

View File

@@ -119,6 +119,7 @@ enum {
/* draw_options */
enum {
ED_GIZMO_CAGE_DRAW_FLAG_NOP = 0,
/** Draw a central handle (instead of having the entire area selectable)
* Needed for large rectangles that we don't want to swallow all events. */
ED_GIZMO_CAGE_DRAW_FLAG_XFORM_CENTER_HANDLE = (1 << 0),