Fixed small dynamic window/popup drawing bug

This commit is contained in:
vurtun 2016-03-04 18:51:49 +01:00
parent be1bf23385
commit a52f25c7a8
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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 {