Skip to content

Commit

Permalink
Merge branch 'diggit-nk_drag_fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
vurtun committed Jun 10, 2018
2 parents b1209db + b5eb3cd commit 38c8d54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/nuklear_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand Down

0 comments on commit 38c8d54

Please sign in to comment.