use containing_rect() in position_element()
This commit is contained in:
parent
78fc1c1e87
commit
278e4988e9
2
TODO
2
TODO
@ -59,7 +59,7 @@ to maintain focus until mouse release (fix scroll bars)
|
|||||||
[ ] Find a way to concile pixel measurements to the mm ones used in css, for example in min/max sizing
|
[ ] Find a way to concile pixel measurements to the mm ones used in css, for example in min/max sizing
|
||||||
of elements
|
of elements
|
||||||
[ ] Center elements to div (center children_bounds to the center of the div bounds and shift the origin accordingly)
|
[ ] Center elements to div (center children_bounds to the center of the div bounds and shift the origin accordingly)
|
||||||
[ ] Use containing_rect() in position_element() to skip some computing and semplify the function
|
[x] Use containing_rect() in position_element() to skip some computing and semplify the function
|
||||||
[ ] Rename position_element() to layout_element()
|
[ ] Rename position_element() to layout_element()
|
||||||
[ ] Make functions to mark rows/columns as full, to fix the calculator demo
|
[ ] Make functions to mark rows/columns as full, to fix the calculator demo
|
||||||
|
|
||||||
|
@ -146,16 +146,7 @@ fn Rect Ctx.position_element(&ctx, Elem *parent, Rect rect, Style* style)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 5. Update the parent's children bounds
|
// 5. Update the parent's children bounds
|
||||||
if (!child_occupied.bottom_right().in_rect(div.children_bounds)) {
|
div.children_bounds = containing_rect(div.children_bounds, child_occupied);
|
||||||
// right overflow
|
|
||||||
if (child_occupied.bottom_right().x > div.children_bounds.bottom_right().x) {
|
|
||||||
div.children_bounds.w += child_occupied.bottom_right().x - div.children_bounds.bottom_right().x;
|
|
||||||
}
|
|
||||||
// bottom overflow
|
|
||||||
if (child_occupied.bottom_right().y > div.children_bounds.bottom_right().y) {
|
|
||||||
div.children_bounds.h += child_occupied.bottom_right().y - div.children_bounds.bottom_right().y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 99. return the placement
|
// 99. return the placement
|
||||||
if (child_placement.collides(parent_view)) {
|
if (child_placement.collides(parent_view)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user