Merge branch 'diggit-nk_drag_fix'

This commit is contained in:
vurtun 2018-06-10 17:25:52 +02:00
commit 38c8d54437
2 changed files with 6 additions and 2 deletions

View File

@ -15550,6 +15550,7 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
/* window movement */
if ((win->flags & NK_WINDOW_MOVABLE) && !(win->flags & NK_WINDOW_ROM)) {
int left_mouse_down;
int left_mouse_clicked;
int left_mouse_click_in_cursor;
/* calculate draggable window space */
@ -15564,9 +15565,10 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
/* window movement by dragging */
left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down;
left_mouse_clicked = (int)in->mouse.buttons[NK_BUTTON_LEFT].clicked;
left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in,
NK_BUTTON_LEFT, header, nk_true);
if (left_mouse_down && left_mouse_click_in_cursor) {
if (left_mouse_down && left_mouse_click_in_cursor && !left_mouse_clicked) {
win->bounds.x = win->bounds.x + in->mouse.delta.x;
win->bounds.y = win->bounds.y + in->mouse.delta.y;
in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x += in->mouse.delta.x;

View File

@ -123,6 +123,7 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
/* window movement */
if ((win->flags & NK_WINDOW_MOVABLE) && !(win->flags & NK_WINDOW_ROM)) {
int left_mouse_down;
int left_mouse_clicked;
int left_mouse_click_in_cursor;
/* calculate draggable window space */
@ -137,9 +138,10 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
/* window movement by dragging */
left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down;
left_mouse_clicked = (int)in->mouse.buttons[NK_BUTTON_LEFT].clicked;
left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in,
NK_BUTTON_LEFT, header, nk_true);
if (left_mouse_down && left_mouse_click_in_cursor) {
if (left_mouse_down && left_mouse_click_in_cursor && !left_mouse_clicked) {
win->bounds.x = win->bounds.x + in->mouse.delta.x;
win->bounds.y = win->bounds.y + in->mouse.delta.y;
in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x += in->mouse.delta.x;