ref: 664a52591895e867ebdac2a56588cf3595b326e8
parent: 920994c010d4539e1cf5965d55e51dcb4f8ccacf
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Jan 16 06:54:26 EST 2020
separate autoresize for width and height
--- a/microui.c
+++ b/microui.c
@@ -1349,8 +1349,10 @@
/* resize to content size */
if (opt & MU_OPT_AUTOSIZE) {
mu_Rect r = get_layout()->body;
- cnt->rect.w = cnt->content_size.x + (cnt->rect.w - r.w);
- cnt->rect.h = cnt->content_size.y + (cnt->rect.h - r.h);
+ if (opt & MU_OPT_AUTOSIZE_W)
+ cnt->rect.w = cnt->content_size.x + (cnt->rect.w - r.w);
+ if (opt & MU_OPT_AUTOSIZE_H)
+ cnt->rect.h = cnt->content_size.y + (cnt->rect.h - r.h);
}
/* close if this is a popup window and elsewhere was clicked */
--- a/microui.h
+++ b/microui.h
@@ -80,7 +80,9 @@
MU_OPT_NOCLOSE = 1<<6,
MU_OPT_NOTITLE = 1<<7,
MU_OPT_HOLDFOCUS = 1<<8,
- MU_OPT_AUTOSIZE = 1<<9,
+ MU_OPT_AUTOSIZE_W = 1<<9,
+ MU_OPT_AUTOSIZE_H = 1<<10,
+ MU_OPT_AUTOSIZE = (MU_OPT_AUTOSIZE_W|MU_OPT_AUTOSIZE_H),
MU_OPT_POPUP = 1<<10,
MU_OPT_CLOSED = 1<<11,
};