From e2180c3454d11f1efdfb17cb3a381a664b71be5c Mon Sep 17 00:00:00 2001 From: "te:ma" <00001101@rambler.ru> Date: Sat, 9 May 2020 16:46:54 +0300 Subject: [PATCH] Fix 'nk_menubar' height calculation bug --- nuklear.h | 11 +++++++---- package.json | 2 +- src/CHANGELOG | 1 + src/nuklear_menu.c | 10 ++++++---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/nuklear.h b/nuklear.h index 76b11ff6c..ee2ec575d 100644 --- a/nuklear.h +++ b/nuklear.h @@ -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; @@ -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 diff --git a/package.json b/package.json index 9fac7e9cf..b6d773014 100644 --- a/package.json +++ b/package.json @@ -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"], diff --git a/src/CHANGELOG b/src/CHANGELOG index c92123795..c04acd443 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -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 diff --git a/src/nuklear_menu.c b/src/nuklear_menu.c index 5b2879e0c..03d37b647 100644 --- a/src/nuklear_menu.c +++ b/src/nuklear_menu.c @@ -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;