support growing target for scrollable node
This commit is contained in:
parent
d8601f23f5
commit
338e3f2d58
1 changed files with 6 additions and 2 deletions
|
@ -51,13 +51,17 @@ int scrollable_handle(UINode *node, enum UIEvent ev, size_t d, void *p)
|
||||||
if (target->width_policy == UI_SIZE_POLICY_DYNAMIC) {
|
if (target->width_policy == UI_SIZE_POLICY_DYNAMIC) {
|
||||||
node_dispatch(target, UI_EVENT_GET_WIDTH, 0, &w);
|
node_dispatch(target, UI_EVENT_GET_WIDTH, 0, &w);
|
||||||
target->rect.w = w;
|
target->rect.w = w;
|
||||||
|
} else if (target->width_policy == UI_SIZE_POLICY_GROW) {
|
||||||
|
target->rect.w = node->parent->rect.w;
|
||||||
}
|
}
|
||||||
if (target->height_policy == UI_SIZE_POLICY_DYNAMIC) {
|
if (target->height_policy == UI_SIZE_POLICY_DYNAMIC) {
|
||||||
node_dispatch(target, UI_EVENT_GET_HEIGHT, 0, &h);
|
node_dispatch(target, UI_EVENT_GET_HEIGHT, 0, &h);
|
||||||
target->rect.h = h;
|
target->rect.h = h;
|
||||||
|
} else if (target->height_policy == UI_SIZE_POLICY_GROW) {
|
||||||
|
target->rect.h = node->parent->rect.h;
|
||||||
}
|
}
|
||||||
target->rect.x = -n->x_scroll;
|
target->rect.x = n->x_scroll ? -n->x_scroll : 0;
|
||||||
target->rect.y = -n->y_scroll;
|
target->rect.y = n->y_scroll ? -n->y_scroll : 0;
|
||||||
node_dispatch(target, UI_EVENT_RELAYOUT, 0, NULL);
|
node_dispatch(target, UI_EVENT_RELAYOUT, 0, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue