Fixed group inside group scrolling
This commit deactivates scrolling for each parent group and window of a panel to only allow exactly *one* active scrollbar.
This commit is contained in:
parent
30087c41ef
commit
848d35ea68
15
nuklear.h
15
nuklear.h
@ -15931,14 +15931,21 @@ nk_panel_end(struct nk_context *ctx)
|
|||||||
|
|
||||||
/* only allow scrolling if parent window is active */
|
/* only allow scrolling if parent window is active */
|
||||||
scroll_has_scrolling = 0;
|
scroll_has_scrolling = 0;
|
||||||
if (!(root->flags & NK_WINDOW_ROM)) {
|
if (!(root->flags & NK_WINDOW_ROM) && layout->has_scrolling) {
|
||||||
/* and groups is being hovered and inside clip rect*/
|
/* and group is being hovered and inside clip rect*/
|
||||||
if (nk_input_is_mouse_hovering_rect(in, layout->bounds) &&
|
if (nk_input_is_mouse_hovering_rect(in, layout->bounds) &&
|
||||||
NK_INTERSECT(layout->bounds.x, layout->bounds.y, layout->bounds.w, layout->bounds.h,
|
NK_INTERSECT(layout->bounds.x, layout->bounds.y, layout->bounds.w, layout->bounds.h,
|
||||||
root->clip.x, root->clip.y, root->clip.w, root->clip.h))
|
root->clip.x, root->clip.y, root->clip.w, root->clip.h))
|
||||||
{
|
{
|
||||||
scroll_has_scrolling = nk_true;
|
/* deactivate all parent scrolling */
|
||||||
|
struct nk_panel *root;
|
||||||
|
root = window->layout;
|
||||||
|
while (root->parent) {
|
||||||
|
root->has_scrolling = nk_false;
|
||||||
|
root = root->parent;
|
||||||
|
}
|
||||||
root->has_scrolling = nk_false;
|
root->has_scrolling = nk_false;
|
||||||
|
scroll_has_scrolling = nk_true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!(window->flags & NK_WINDOW_SUB)) {
|
} else if (!(window->flags & NK_WINDOW_SUB)) {
|
||||||
@ -15963,7 +15970,7 @@ nk_panel_end(struct nk_context *ctx)
|
|||||||
if (layout->flags & NK_WINDOW_SUB) {
|
if (layout->flags & NK_WINDOW_SUB) {
|
||||||
bounds.h = scrollbar_size.x;
|
bounds.h = scrollbar_size.x;
|
||||||
bounds.y = (layout->flags & NK_WINDOW_BORDER) ?
|
bounds.y = (layout->flags & NK_WINDOW_BORDER) ?
|
||||||
layout->bounds.y + 1 : layout->bounds.y;
|
layout->bounds.y + layout->border : layout->bounds.y;
|
||||||
bounds.y += layout->header_h + layout->menu.h + layout->height;
|
bounds.y += layout->header_h + layout->menu.h + layout->height;
|
||||||
bounds.w = layout->width;
|
bounds.w = layout->width;
|
||||||
} else if (layout->flags & NK_WINDOW_DYNAMIC) {
|
} else if (layout->flags & NK_WINDOW_DYNAMIC) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user