Fix unnecessary combo flips

When user given height is less than content height, use that (will have
a scrollbar) so we don't flip unnecessarily

Opposite of Menu example of larger than needed requested height, in
which case we use real content height to determine whether to flip
This commit is contained in:
Robert Winkler
2026-11-26 01:36:11 -05:00
committed by Rob Loach
parent 7fee1db123
commit fa7240a788
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -21571,6 +21571,12 @@ nk_fit_popup_rect(const struct nk_context *ctx, struct nk_rect body,
d_right = d.x + d.w;
d_bottom = d.y + d.h;
req_h = body.h;
/* last_h is unclamped layout height (every row, including those that
* would scroll). Combos pass a smaller panel (e.g. 200 with 370px of
* items); menus pass a larger max (e.g. 600 with 80px of trees).
* Judge the visible panel: min(content, caller max). */
if (known_h > req_h)
known_h = req_h;
need_h = (known_h > 0.0f) ? known_h : req_h;
overlap = (anchor.y + anchor.h) - body.y;
+6
View File
@@ -27,6 +27,12 @@ nk_fit_popup_rect(const struct nk_context *ctx, struct nk_rect body,
d_right = d.x + d.w;
d_bottom = d.y + d.h;
req_h = body.h;
/* last_h is unclamped layout height (every row, including those that
* would scroll). Combos pass a smaller panel (e.g. 200 with 370px of
* items); menus pass a larger max (e.g. 600 with 80px of trees).
* Judge the visible panel: min(content, caller max). */
if (known_h > req_h)
known_h = req_h;
need_h = (known_h > 0.0f) ? known_h : req_h;
overlap = (anchor.y + anchor.h) - body.y;