-
Notifications
You must be signed in to change notification settings - Fork 112
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
feat(#574): reimplementation of Image
widget layout
function
#605
base: main
Are you sure you want to change the base?
Conversation
Reimplement calculation of image size in `Image` widget `layout` function. Makes it match against `self.fill` before setting size.
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. |
Create testing case for `layout` function.
Ready for review. |
There is still one point open: should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that this PR does not introduce a regression in the default Contain
case in the examples. And the tests look good.
Regarding renaming FillStrat
, I'll defer to the maintainers. I don't love the current name, but it works. So I'm open to either renaming or keeping it.
One comment I have is that there is code in the implementation of |
I think the code of Positioning of an image is a work for the But maybe I'm missing something. |
Next steps here are removing any unused code, if there is some. I think renaming |
If you rename it, we can remove it from the typos config too! |
e9aabc3
to
e8dcd0b
Compare
Renamed the struct but couldn't find any unused code to remove.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know when you're happy for this to land once you've addressed/decided against these comments.
@@ -28,7 +28,7 @@ use crate::{ | |||
/// than the image size). | |||
pub struct Image { | |||
image_data: ImageBuf, | |||
fill: FillStrat, | |||
fill: ObjectFit, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this field? I'd suggest either fit
or object_fit
?
@@ -61,7 +61,7 @@ use crate::{Affine, Size}; | |||
// These are based on https://api.flutter.dev/flutter/painting/BoxFit-class.html | |||
/// Strategies for inscribing a rectangle inside another rectangle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we link to https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit in these docs?
Reimplement calculation of image size in
Image
widgetlayout
function.Makes it match against
self.fill
before setting size.Tests still missing.
Fixes #574