We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When windows are pixel-perfect aligned one next to the other, the hover status isn't updated properly.
Replace the window in the default demo with the following:
if (nk_begin(ctx, "Demo1", nk_rect(100, 100, 200, 200), NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE)) { nk_layout_row_dynamic(ctx, 80, 1); nk_button_label(ctx, "button"); } nk_end(ctx); if (nk_begin(ctx, "Demo2", nk_rect(300, 100, 200, 200), NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE)) { nk_layout_row_dynamic(ctx, 80, 1); nk_button_label(ctx, "button"); } nk_end(ctx);
The left button doesn't react on hover.
When windows are spread apart by 1 or more pixels, hover works fine:
if (nk_begin(ctx, "Demo1", nk_rect(100, 100, 200, 200), NK_WINDOW_MOVABLE|NK_WINDOW_TITLE)) { nk_layout_row_dynamic(ctx, 80, 1); nk_button_label(ctx, "button"); } nk_end(ctx); if (nk_begin(ctx, "Demo2", nk_rect(300 + 1, 100, 200, 200), NK_WINDOW_MOVABLE|NK_WINDOW_TITLE)) { nk_layout_row_dynamic(ctx, 80, 1); nk_button_label(ctx, "button"); } nk_end(ctx);
The hover isn't updated, because windows are detected as intersecting each other:
Nuklear/src/nuklear_window.c
Lines 221 to 242 in adc52d7
NK_INTERSECT
Nuklear/src/nuklear.h
Lines 5405 to 5406 in adc52d7
#define NK_INTERSECT(x0, y0, w0, h0, x1, y1, w1, h1) \ (!(((x1 >= (x0 + w0)) || ((x1 + w1) <= x0) || (y1 >= (y0 + h0)) || (y1 + h1) <= y0)))
This way, it would match all the other checks based on NK_BETWEEN which is also exclusive in the upper bound:
NK_BETWEEN
Lines 5402 to 5404 in adc52d7
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What?
When windows are pixel-perfect aligned one next to the other, the hover status isn't updated properly.
Minimum example
Replace the window in the default demo with the following:
The left button doesn't react on hover.
When windows are spread apart by 1 or more pixels, hover works fine:
Suggested fix
The hover isn't updated, because windows are detected as intersecting each other:
Nuklear/src/nuklear_window.c
Lines 221 to 242 in adc52d7
The
NK_INTERSECT
is defined as:Nuklear/src/nuklear.h
Lines 5405 to 5406 in adc52d7
I'd suggest to fix the off-by-one error by making the upper bound exclusive:
This way, it would match all the other checks based on
NK_BETWEEN
which is also exclusive in the upper bound:Nuklear/src/nuklear.h
Lines 5402 to 5404 in adc52d7
The text was updated successfully, but these errors were encountered: