-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image element blocks resizing #6865
Comments
I dug a little further and found out what the difference is between using an image or a plain rectangle: An So this is "reproducible" without an image: component Main inherits Window {
HorizontalLayout {
Rectangle {
background: green;
}
Rectangle {
background: red;
Rectangle {
background: blue;
width: 50px;
height: 50px;
preferred-width: 165px;
preferred-height: 66px;
}
}
}
} (This is not a final statement of resolution, just posting my results of investigating this :) |
After playing a bit more with it, so this what I think is happening: The available width of the Window, that @jmEvoqua I think the answer to this original question then is: The image expresses a preferred size, as opposed to the "empty" rectangle, and the layout takes that into account. All in what I think is an attempt to avoid scaling the image unless necessary. |
Thanks for the help. This explains why the image has a starting width. But there is still one difference. The red rectangle with the image does not resize at all (not using more of the available space). The red rectangle in your example with the other rectangle does resize. It will be larger than the green Rectangle, but that is expected. |
That's right. I think that's because the plain
|
Thanks for the explanation :) I understand it now. |
I think our initial reaction yesterday was to mark this as a bug. With this analysis, I think we need to improve on the documentation. The central question was why the While the underlying information may be spread out in the docs, what's missing is a more element centric view on the behaviour of the layouts. |
On second thought: Perhaps it's a bug that the Image's preferred size is used and propagated when the Image can never obtain that size because it's already fixed. |
I discussed with Olivier and we agreed that if an element has a fixed width/height, it doesn't make sense to maintain the preferred size. We already fix up min/max width, so we should also do that for preferred width/height if a fixed width is set. |
Bug Description
During refactoring I noticed that an image element blocks the resizing(stretching) in a layout. If I replace the image with an rectangle of the same size the resizing works as expected.
I expected a fixed sized image element to behave the same as a fixed sized rectangle:
What makes it even worse is that when the image is conditional, it works as expected. This makes it very hard to reason about the layout system.
if true: Image {
Reproducible Code (if applicable)
Environment Details
Product Impact
This sort of bugs makes it hard to understand the (not so intuitive) layout system and requires additional time to find workarounds. The initial fast development speed is slowed down drastically when something odd in the layout happens.
The text was updated successfully, but these errors were encountered: