KamelImage fills up max size
zeroeightysix opened this issue · comments
Rather counterintuitively, and annoyingly, KamelImage
without a Modifier
to restrict its size will consume all space it can get due to this default modifier:
Kamel/kamel-image/src/commonMain/kotlin/io/kamel/image/KamelImage.kt
Lines 45 to 54 in 291f157
This leads to it being the case that if you include any image in an unbounded box that the entire UI just becomes that image. For our usecase, we have a very wide banner image that is supposed to fill up the parent's entire width but not the height. This default prevents that from happening 🙁
Can't we make the inner Image
have no modifier?
@zeroeightysix So that modifier will actually cause it to fill the size of KamelImageBox
. and the modifier here lets you apply whatever modifiers you want to the box. Is that not working for you?
Also you can always make your own version of KamelImage
using KamelImageBox
if you need some non-standard behavior
@zeroeightysix So that modifier will actually cause it to fill the size of
KamelImageBox
. and the modifier here lets you apply whatever modifiers you want to the box. Is that not working for you?Also you can always make your own version of
KamelImage
usingKamelImageBox
if you need some non-standard behavior
As the box sizes to fit its contents, it will grow larger than the image dimensions themselves.
You'd expect, without any modifiers, for the box to be the same size as the actual image, tightly wrapping around it. Instead, both the box and inner Image
take up more space than is required to display the image; is that intentional?
Yeah I suppose it makes more sense to display an image in its actual size by default. I think it should just work that way if I removed that modifier... The only thing I'm worried about is that it may cause issues with contentScale
. I'd have to check I think