Skip to content

Commit

Permalink
Fix 'nk_menubar' height calculation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
exchg committed May 11, 2020
1 parent 910df27 commit e2180c3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -20983,13 +20983,15 @@ nk_menubar_end(struct nk_context *ctx)
if (layout->flags & NK_WINDOW_HIDDEN || layout->flags & NK_WINDOW_MINIMIZED)
return;

layout->menu.h = layout->at_y - layout->menu.y;
layout->bounds.y += layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
layout->bounds.h -= layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
layout->menu.h = layout->at_y - layout->menu.y;
layout->menu.h += layout->row.height + ctx->style.window.spacing.y;

layout->bounds.y += layout->menu.h;
layout->bounds.h -= layout->menu.h;

*layout->offset_x = layout->menu.offset.x;
*layout->offset_y = layout->menu.offset.y;
layout->at_y = layout->bounds.y - layout->row.height;
layout->at_y = layout->bounds.y - layout->row.height;

layout->clip.y = layout->bounds.y;
layout->clip.h = layout->bounds.h;
Expand Down Expand Up @@ -29091,6 +29093,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
/// - [yy]: Minor version with non-breaking API and library changes
/// - [zz]: Bug fix version with no direct changes to API
///
/// - 2020/05/09 (4.02.3) - Fix nk_menubar height calculation bug
/// - 2020/04/30 (4.02.2) - Fix nk_edit border drawing bug
/// - 2020/04/09 (4.02.1) - Removed unused nk_sqrt function to fix compiler warnings
/// - Fixed compiler warnings if you bring your own methods for
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuklear",
"version": "4.02.2",
"version": "4.02.3",
"repo": "Immediate-Mode-UI/Nuklear",
"description": "A small ANSI C gui toolkit",
"keywords": ["gl", "ui", "toolkit"],
Expand Down
1 change: 1 addition & 0 deletions src/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/// - [yy]: Minor version with non-breaking API and library changes
/// - [zz]: Bug fix version with no direct changes to API
///
/// - 2020/05/09 (4.02.3) - Fix nk_menubar height calculation bug
/// - 2020/04/30 (4.02.2) - Fix nk_edit border drawing bug
/// - 2020/04/09 (4.02.1) - Removed unused nk_sqrt function to fix compiler warnings
/// - Fixed compiler warnings if you bring your own methods for
Expand Down
10 changes: 6 additions & 4 deletions src/nuklear_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ nk_menubar_end(struct nk_context *ctx)
if (layout->flags & NK_WINDOW_HIDDEN || layout->flags & NK_WINDOW_MINIMIZED)
return;

layout->menu.h = layout->at_y - layout->menu.y;
layout->bounds.y += layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
layout->bounds.h -= layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
layout->menu.h = layout->at_y - layout->menu.y;
layout->menu.h += layout->row.height + ctx->style.window.spacing.y;

layout->bounds.y += layout->menu.h;
layout->bounds.h -= layout->menu.h;

*layout->offset_x = layout->menu.offset.x;
*layout->offset_y = layout->menu.offset.y;
layout->at_y = layout->bounds.y - layout->row.height;
layout->at_y = layout->bounds.y - layout->row.height;

layout->clip.y = layout->bounds.y;
layout->clip.h = layout->bounds.h;
Expand Down

0 comments on commit e2180c3

Please sign in to comment.