Limit size of child to bounds of parent when applying visualPadding#94
Limit size of child to bounds of parent when applying visualPadding#94weisJ wants to merge 1 commit intomikaelgrev:masterfrom
Conversation
|
I'm also interested in a solution for this problem. It occurs often when nesting panels. Here is a screenshot that shows the problem (cut-off focus border if nested panel uses This PR works, it simply reduces the size of the components if they are outside of the container. The components no longer have their preferred sizes. Here is an example that shows that button height gets too small Another problem is that if components are "intentionally" placed partly (or fully) outside of the container, then this PR "forces" them into the container bounds. A "manual" fix for the issue would be to increase the layout insets for the nested panels where necessary (e.g. change layout constraints from It would be great to find a solution that automatically increases the container insets, but only on those sides where it is necessary. But have no idea where and how to implement this. I think it has to be done very late in the layout calculation because the bounds of the container and of all children is needed to find out whether a component is located at one of the four sides. |


If child components have e.g. the
fillxconstraint and also visualPaddings specified the child may be layed out outside the parents bounds. This results in e.g. focus rings not be painted on those side.Here is a small example that demonstrated the problem:
Without the patch the magenta border will be invisible.
I am not fully sure it is the correct approach. Maybe there is some scenario where one would actually want a child to extend outside the parent. But I wasn't able to track down the code where
fillconstraints are evaluated to patch it at that point already.Any feedback is highly appreciated.