Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,10 @@ bool iui_switch(iui_context *ctx,
/* Expand touch target for accessibility (48dp minimum per MD3) */
iui_rect_t touch_rect = track_rect;
iui_expand_touch_target_h(&touch_rect, IUI_SWITCH_TOUCH_TARGET);
if (touch_rect.height > ctx->row_height) {
touch_rect.y = ctx->layout.y;
touch_rect.height = ctx->row_height;
}

iui_state_t state = iui_get_component_state(ctx, touch_rect, false);

Expand Down
4 changes: 2 additions & 2 deletions src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,8 @@ static inline iui_vec2 iui_vec2_add(iui_vec2 a, iui_vec2 b)

static inline bool in_rect(const iui_rect_t *rect, iui_vec2 pos)
{
return ((pos.x >= rect->x) && (pos.x <= rect->x + rect->width) &&
(pos.y >= rect->y) && (pos.y <= rect->y + rect->height));
return ((pos.x >= rect->x) && (pos.x < rect->x + rect->width) &&
(pos.y >= rect->y) && (pos.y < rect->y + rect->height));
}

static inline void expand_rect(iui_rect_t *rect, float amount)
Expand Down
4 changes: 2 additions & 2 deletions tests/test-tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@ static void test_focus_switch_between_fields(void)
ASSERT_TRUE(iui_textfield_is_registered(ctx, buf2));

/* Frame 2: Click on field 2 to transfer focus.
* Field 2 starts at ~96dp (after field 1), click at y=120.
* Field 2 is after field 1; click past ~96dp at y=119.
*/
iui_update_mouse_pos(ctx, 150.0f, 120.0f);
iui_update_mouse_pos(ctx, 150.0f, 119.0f);
iui_update_mouse_buttons(ctx, IUI_MOUSE_LEFT, 0);
iui_begin_frame(ctx, 1.0f / 60.0f);
iui_begin_window(ctx, "Test", 0, 0, 300, 300, 0);
Expand Down
Loading