WIP: preserve aspect ratio of images
This commit is contained in:
parent
600b564bbf
commit
3ac545088a
4 changed files with 87 additions and 58 deletions
|
@ -20,7 +20,7 @@ impl RenderOnce for Avatar {
|
|||
type Rendered = Img;
|
||||
|
||||
fn render(self, _: &mut WindowContext) -> Self::Rendered {
|
||||
let mut img = img();
|
||||
let mut img = img(self.src);
|
||||
|
||||
if self.shape == Shape::Circle {
|
||||
img = img.rounded_full();
|
||||
|
@ -28,8 +28,7 @@ impl RenderOnce for Avatar {
|
|||
img = img.rounded_md();
|
||||
}
|
||||
|
||||
img.source(self.src.clone())
|
||||
.size_4()
|
||||
img.size_4()
|
||||
// todo!(Pull the avatar fallback background from the theme.)
|
||||
.bg(gpui::red())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue