Fix a bug where combobox cannot be closed by clicking the header when NK_BUTTON_TRIGGER_ON_RELEASE is defined

master
eax0r 2019-09-20 03:25:19 +02:00 committed by GitHub
parent c43600b77e
commit ea375a1d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -134,7 +134,11 @@ nk_nonblock_begin(struct nk_context *ctx,
} else {
/* close the popup if user pressed outside or in the header */
int pressed, in_body, in_header;
#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
pressed = nk_input_is_mouse_released(&ctx->input, NK_BUTTON_LEFT);
#else
pressed = nk_input_is_mouse_pressed(&ctx->input, NK_BUTTON_LEFT);
#endif
in_body = nk_input_is_mouse_hovering_rect(&ctx->input, body);
in_header = nk_input_is_mouse_hovering_rect(&ctx->input, header);
if (pressed && (!in_body || in_header))