Fixed #545 with window pos/size modifier

This commit is contained in:
vurtun 2017-11-07 18:18:50 +01:00
parent 9e0ed888fb
commit 7eb08b8bcf
2 changed files with 11 additions and 12 deletions

View File

@ -11,6 +11,7 @@
Changes: Changes:
-------- --------
- 2017/11/07 (2.00.3) - Fixed window size and position modifier functions
- 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior - 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior
- 2017/09/14 (2.00.1) - Fixed window closing behavior - 2017/09/14 (2.00.1) - Fixed window closing behavior
- 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now - 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now

View File

@ -18965,11 +18965,10 @@ nk_window_set_position(struct nk_context *ctx,
const char *name, struct nk_vec2 pos) const char *name, struct nk_vec2 pos)
{ {
struct nk_rect bounds; struct nk_rect bounds;
bounds.x = pos.x; struct nk_window *win = nk_window_find(ctx, name);
bounds.y = pos.y; if (!win) return;
bounds.w = ctx->current->bounds.w; win->bounds.x = pos.x;
bounds.h = ctx->current->bounds.h; win->bounds.y = pos.y;
nk_window_set_bounds(ctx, name, bounds);
} }
NK_API void NK_API void
@ -18977,11 +18976,10 @@ nk_window_set_size(struct nk_context *ctx,
const char *name, struct nk_vec2 size) const char *name, struct nk_vec2 size)
{ {
struct nk_rect bounds; struct nk_rect bounds;
bounds.x = ctx->current->bounds.x; struct nk_window *win = nk_window_find(ctx, name);
bounds.y = ctx->current->bounds.y; if (!win) return;
bounds.w = size.x; win->bounds.w = size.x;
bounds.h = size.y; win->bounds.h = size.y;
nk_window_set_bounds(ctx, name, bounds);
} }
NK_API void NK_API void
@ -21268,8 +21266,8 @@ nk_edit_string(struct nk_context *ctx, nk_flags flags,
win->edit.sel_start = edit->select_start; win->edit.sel_start = edit->select_start;
win->edit.sel_end = edit->select_end; win->edit.sel_end = edit->select_end;
win->edit.mode = edit->mode; win->edit.mode = edit->mode;
win->edit.scrollbar.x = (nk_ushort)edit->scrollbar.x; win->edit.scrollbar.x = (nk_uint)edit->scrollbar.x;
win->edit.scrollbar.y = (nk_ushort)edit->scrollbar.y; win->edit.scrollbar.y = (nk_uint)edit->scrollbar.y;
} }
return state; return state;
} }