-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Prevent clicking more than one (overlapping) button per frame #803
Conversation
I just want to give a high-level overview of the changes here: These simple changes unfortunately mean that the |
Here is the example code demonstrating the problem: static int showB = 0;
if (nk_begin(ctx, "Window A", nk_rect(100, 100, 100, 100), NK_WINDOW_TITLE))
{
nk_layout_row_dynamic(ctx, 50, 1);
if (nk_button_label(ctx, "Button A")) {
puts("Button A");
showB = 1;
}
}
nk_end(ctx);
if (showB) {
if (nk_begin(ctx, "Window B", nk_rect(100, 100, 100, 100), NK_WINDOW_TITLE))
{
nk_layout_row_dynamic(ctx, 50, 1);
if (nk_button_label(ctx, "Button B")) {
puts("Button B");
showB = 0;
}
}
nk_end(ctx);
} |
Is anyone able to reproduce this problem? Do I need to bump the version myself before being accepted? |
Great find. A real shame all these fix-related pull requests aren't being implemented in some way. But probably the better way of implementing the fix would have been to add a new nk_flag to nk_widget_states enum, like NK_WIDGET_STATE_CLICKED. Then the only changes need to be made to function nk_button_behavior rather than changing all the const, which has consequences on version backwards compatibility. Something like:
|
@revolucas I hope I can come back to Nuklear maintenance next year (currently it's kind of difficult for me - see #913 (comment) ). |
This hopefully prevents a single click from activating multiple, overlapping buttons. This is a problem when you click in one place on one window that opens a new window with a button in the same place.
See below for the C code to reproduce the problem.