From a52f25c7a850b56e7f9404284856872d9e094a9a Mon Sep 17 00:00:00 2001 From: vurtun Date: Fri, 4 Mar 2016 18:51:49 +0100 Subject: [PATCH] Fixed small dynamic window/popup drawing bug --- CONTRIBUTING.md | 1 - zahnrad.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43aa2b5..da279b1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,6 @@ If you have an idea for new features just [open an issue](https://github.com/vur * Seperator widget is currently bugged and does not work as intended * Text handling is still a little bit janky and probably needs to be further tested and polished * `zr_edit_buffer` with multiline flag is bugged for '\n', need to differentiate between visible and non-visible characters - * combobox popup does not draw correctly for dynamic windows ## Coding conventions * Only use C89 (ANSI C) diff --git a/zahnrad.c b/zahnrad.c index ffb68f4..a8c65d4 100644 --- a/zahnrad.c +++ b/zahnrad.c @@ -8831,6 +8831,7 @@ zr_panel_end(struct zr_context *ctx) if (layout->flags & ZR_WINDOW_DYNAMIC && !(layout->flags & ZR_WINDOW_MINIMIZED)) { layout->height = layout->at_y - layout->bounds.y; layout->height = ZR_MIN(layout->height, layout->bounds.h); + if ((layout->offset->x == 0) || (layout->flags & ZR_WINDOW_NO_SCROLLBAR)) { /* special case for dynamic windows without horizontal scrollbar * or hidden scrollbars */ @@ -8844,10 +8845,10 @@ zr_panel_end(struct zr_context *ctx) /* special case for windows like combobox, menu require draw call * to fill the empty scrollbar background */ struct zr_rect bounds; - bounds.x = layout->bounds.x + layout->width; + bounds.x = layout->bounds.x + layout->width - item_padding.x; bounds.y = layout->clip.y; - bounds.w = scrollbar_size; - bounds.h = layout->height; + bounds.w = scrollbar_size + item_padding.x; + bounds.h = layout->height + item_padding.y; zr_draw_rect(out, bounds, 0, config->colors[ZR_COLOR_WINDOW]); } } else {