feat(#574): reimplementation of `Image` widget `layout` function
Reimplement calculation of image size in Image widget layout function.
Makes it match against self.fill before setting size.
Tests still missing.
Fixes #574
I've edited your comment to include the text "fixes #574", as the version in the title doesn't count.
This looks like a good start, although it'll be easier to judge once there are tests.
Ready for review. Test looks good to me, but still I'm not sure if they are written correctly.
There is still one point open: should FillStrat be renamed?
If yes, to what?
One comment I have is that there is code in the implementation of FillStrat that is not used with this code. What do we want to do about that?
I think the code of FillStrat::affine_to_fill isn't of any use anymore.
Positioning of an image is a work for the Image::layout function, plus the current implementation is much simplier than calculating an affine matrix for then defining positioning/layout inside a BoxConstraint.
But maybe I'm missing something.
Next steps here are removing any unused code, if there is some. I think renaming FillStrat to ObjectFit is uncontroversial, and I'd recommend doing so in this PR. We can always rename it again if needed.
If you rename it, we can remove it from the typos config too!
Next steps here are removing any unused code, if there is some. I think renaming
FillStrattoObjectFitis uncontroversial, and I'd recommend doing so in this PR. We can always rename it again if needed.
Renamed the struct but couldn't find any unused code to remove.
If you rename it, we can remove it from the typos config too!
Done.
Thanks!