From 75c71790f30c3d69ccfd6e33ac7c7764acfcfd0a Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Wed, 11 Mar 2020 18:45:36 +0100 Subject: [PATCH] Fix bug where padding was subtracted from widget This caused combo boxes to draw its items before the panel padding, causing the text to be clipped off. The code deleted here seems to have been an effort to solve what 14dd68e solved so it makes sense that these would conflict. I'm pretty sure 14dd68e is the correct solution though and this was some old hack. --- nuklear.h | 11 +---------- package.json | 2 +- src/CHANGELOG | 1 + src/nuklear_widget.c | 10 ---------- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/nuklear.h b/nuklear.h index 0a20f5f..b8634bd 100644 --- a/nuklear.h +++ b/nuklear.h @@ -22839,16 +22839,6 @@ nk_widget_fitting(struct nk_rect *bounds, struct nk_context *ctx, style = &ctx->style; layout = win->layout; state = nk_widget(bounds, ctx); - - panel_padding = nk_panel_get_padding(style, layout->type); - if (layout->row.index == 1) { - bounds->w += panel_padding.x; - bounds->x -= panel_padding.x; - } else bounds->x -= item_padding.x; - - if (layout->row.index == layout->row.columns) - bounds->w += panel_padding.x; - else bounds->w += item_padding.x; return state; } NK_API void @@ -29110,6 +29100,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/03/11 (4.01.8) - Fix bug where padding is subtracted from widget /// - 2020/03/06 (4.01.7) - Fix bug where width padding was applied twice /// - 2020/02/06 (4.01.6) - Update stb_truetype.h and stb_rect_pack.h and separate them /// - 2019/12/10 (4.01.5) - Fix off-by-one error in NK_INTERSECT diff --git a/package.json b/package.json index 73ad409..c3a0a1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuklear", - "version": "4.01.7", + "version": "4.01.8", "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 f534e66..75fd8cb 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/03/11 (4.01.8) - Fix bug where padding is subtracted from widget /// - 2020/03/06 (4.01.7) - Fix bug where width padding was applied twice /// - 2020/02/06 (4.01.6) - Update stb_truetype.h and stb_rect_pack.h and separate them /// - 2019/12/10 (4.01.5) - Fix off-by-one error in NK_INTERSECT diff --git a/src/nuklear_widget.c b/src/nuklear_widget.c index d06c36f..a20482e 100644 --- a/src/nuklear_widget.c +++ b/src/nuklear_widget.c @@ -200,16 +200,6 @@ nk_widget_fitting(struct nk_rect *bounds, struct nk_context *ctx, style = &ctx->style; layout = win->layout; state = nk_widget(bounds, ctx); - - panel_padding = nk_panel_get_padding(style, layout->type); - if (layout->row.index == 1) { - bounds->w += panel_padding.x; - bounds->x -= panel_padding.x; - } else bounds->x -= item_padding.x; - - if (layout->row.index == layout->row.columns) - bounds->w += panel_padding.x; - else bounds->w += item_padding.x; return state; } NK_API void