xilem icon indicating copy to clipboard operation
xilem copied to clipboard

feat(#574): reimplementation of `Image` widget `layout` function

Open failingprovince opened this issue 1 year ago • 7 comments

Reimplement calculation of image size in Image widget layout function. Makes it match against self.fill before setting size.

Tests still missing.

Fixes #574

failingprovince avatar Sep 22 '24 20:09 failingprovince

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.

DJMcNab avatar Sep 23 '24 08:09 DJMcNab

Ready for review. Test looks good to me, but still I'm not sure if they are written correctly.

failingprovince avatar Sep 24 '24 18:09 failingprovince

There is still one point open: should FillStrat be renamed? If yes, to what?

failingprovince avatar Sep 24 '24 19:09 failingprovince

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?

jaredoconnell avatar Sep 25 '24 04:09 jaredoconnell

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.

failingprovince avatar Sep 25 '24 08:09 failingprovince

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.

DJMcNab avatar Sep 30 '24 11:09 DJMcNab

If you rename it, we can remove it from the typos config too!

waywardmonkeys avatar Sep 30 '24 13:09 waywardmonkeys

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.

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.

failingprovince avatar Sep 30 '24 19:09 failingprovince

Thanks!

DJMcNab avatar Oct 02 '24 10:10 DJMcNab