|
@@ -4667,6 +4667,9 @@ struct nk_mouse_button {
|
|
struct nk_mouse {
|
|
struct nk_mouse {
|
|
struct nk_mouse_button buttons[NK_BUTTON_MAX];
|
|
struct nk_mouse_button buttons[NK_BUTTON_MAX];
|
|
struct nk_vec2 pos;
|
|
struct nk_vec2 pos;
|
|
|
|
+#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
|
|
|
|
+ struct nk_vec2 down_pos;
|
|
|
|
+#endif
|
|
struct nk_vec2 prev;
|
|
struct nk_vec2 prev;
|
|
struct nk_vec2 delta;
|
|
struct nk_vec2 delta;
|
|
struct nk_vec2 scroll_delta;
|
|
struct nk_vec2 scroll_delta;
|
|
@@ -17894,6 +17897,13 @@ nk_input_button(struct nk_context *ctx, enum nk_buttons id, int x, int y, nk_boo
|
|
btn->clicked_pos.y = (float)y;
|
|
btn->clicked_pos.y = (float)y;
|
|
btn->down = down;
|
|
btn->down = down;
|
|
btn->clicked++;
|
|
btn->clicked++;
|
|
|
|
+#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
|
|
|
|
+ if (down == 1 && id == NK_BUTTON_LEFT)
|
|
|
|
+ {
|
|
|
|
+ in->mouse.down_pos.x = btn->clicked_pos.x;
|
|
|
|
+ in->mouse.down_pos.y = btn->clicked_pos.y;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
NK_API void
|
|
NK_API void
|
|
nk_input_scroll(struct nk_context *ctx, struct nk_vec2 val)
|
|
nk_input_scroll(struct nk_context *ctx, struct nk_vec2 val)
|
|
@@ -17954,7 +17964,12 @@ nk_input_has_mouse_click_in_rect(const struct nk_input *i, enum nk_buttons id,
|
|
const struct nk_mouse_button *btn;
|
|
const struct nk_mouse_button *btn;
|
|
if (!i) return nk_false;
|
|
if (!i) return nk_false;
|
|
btn = &i->mouse.buttons[id];
|
|
btn = &i->mouse.buttons[id];
|
|
|
|
+#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
|
|
|
|
+ if (!NK_INBOX(btn->clicked_pos.x,btn->clicked_pos.y,b.x,b.y,b.w,b.h)
|
|
|
|
+ || !NK_INBOX(i->mouse.down_pos.x,i->mouse.down_pos.y,b.x,b.y,b.w,b.h))
|
|
|
|
+#else
|
|
if (!NK_INBOX(btn->clicked_pos.x,btn->clicked_pos.y,b.x,b.y,b.w,b.h))
|
|
if (!NK_INBOX(btn->clicked_pos.x,btn->clicked_pos.y,b.x,b.y,b.w,b.h))
|
|
|
|
+#endif
|
|
return nk_false;
|
|
return nk_false;
|
|
return nk_true;
|
|
return nk_true;
|
|
}
|
|
}
|
|
@@ -29651,7 +29666,9 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
|
|
/// - [y]: Minor version with non-breaking API and library changes
|
|
/// - [y]: Minor version with non-breaking API and library changes
|
|
/// - [z]: Patch version with no direct changes to the API
|
|
/// - [z]: Patch version with no direct changes to the API
|
|
///
|
|
///
|
|
-/// - 2022/04/15 (4.9.7) - Added nk_rule_horizontal() widget
|
|
|
|
|
|
+/// - 2022/04/19 (4.9.8) - Added nk_rule_horizontal() widget
|
|
|
|
+/// - 2022/04/18 (4.9.7) - Change button behavior when NK_BUTTON_TRIGGER_ON_RELEASE is defined to
|
|
|
|
+/// only trigger when the mouse position was inside the same button on down
|
|
/// - 2022/02/03 (4.9.6) - Allow overriding the NK_INV_SQRT function, similar to NK_SIN and NK_COS
|
|
/// - 2022/02/03 (4.9.6) - Allow overriding the NK_INV_SQRT function, similar to NK_SIN and NK_COS
|
|
/// - 2021/12/22 (4.9.5) - Revert layout bounds not accounting for padding due to regressions
|
|
/// - 2021/12/22 (4.9.5) - Revert layout bounds not accounting for padding due to regressions
|
|
/// - 2021/12/22 (4.9.4) - Fix checking hovering when window is minimized
|
|
/// - 2021/12/22 (4.9.4) - Fix checking hovering when window is minimized
|