-
Notifications
You must be signed in to change notification settings - Fork 787
Description
Bug Description
Hi !
It would appear that certain objects have the ability to impose their size on their parents, while others do not.
As we will see, certain items behave differently depending on the type of object they contain and/or the type of parent.
This makes the use of certain combinations of objects rather confusing and unintuitive.
for example i take a very basic example :
export component ExSizingRectangles {
VerticalLayout {
Rectangle {
background: blue;
}
Rectangle {
background: yellow;
Rectangle {
background: green;
height: 50%;
}
}
}
}We obtain this , as expected :
so looking a this we can say that rectangle in layouts d'ont care about the size of what there is inside.
Exept this is not true with Text for example :
export component ExSizingText {
height: 250px;
VerticalLayout {
Rectangle {
background: blue;
}
Rectangle {
background: yellow;
Text {
text: "test";
}
}
}
}
From what I understand, the object text overrides the dimensions of its parent.
this also works by overwriting the min width of the parent
we can break this analysys by adding a if statment :
export component ExSizingTextBypass {
height: 250px;
VerticalLayout {
Rectangle {
background: blue;
}
Rectangle {
background: yellow;
if true : Text {
text: "test";
}
}
}
}
With this "if true" statment , we now have the same behavior as the previous rectangles.
Of course, using an “if” statment for this is a bit messy.
However, this possibility seems essential, and having an appropriate syntax would be much better.
But that's not all: if we remove the text from the rectangle, we return to the initial behavior, despite the if statement.
export component ExSizingTexBypassFailed {
height: 250px;
VerticalLayout {
Rectangle {
background: blue;
}
if true : Text {
text: "test";
}
}
}
This last example may be ok i guess,
however, I believe that, layout aside, no element should force the size of its parent, as this can already be achieved with parameters.