imgui_add_hit_region
Add invisible interactive hit regions to Dear ImGui windows to detect hover, click, drag, double-click, and wheel events. Define shapes as rect, circle, ellipse, or polygon for flexible input capture.
Instructions
Add an interactive hit region to a window. Hit regions are invisible shapes that detect mouse hover, click, drag, double-click, and wheel events. Use with imgui_get_canvas_events to read interactions. Shapes: rect, circle, ellipse, polygon.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Unique hit region identifier | |
| p1 | No | Rect: min corner [x,y]. Circle/Ellipse: center [x,y] | |
| p2 | No | Rect: max corner [x,y]. Circle: [radius, 0]. Ellipse: [rx, ry] | |
| shape | Yes | Hit region shape type | |
| points | No | Polygon vertices as [[x,y], ...] (for polygon shape) | |
| window | Yes | Target window id | |
| transform | No | Transform applied to the hit region shape | |
| draw_layer | No | Optional associated draw layer widget id | |
| interactions | No | Enabled interaction types (default: hover + click) |