mirror of
https://github.com/Immediate-Mode-UI/Nuklear.git
synced 2026-11-30 16:48:10 +01:00
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:
committed by
Rob Loach
parent
7fee1db123
commit
fa7240a788
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user