WIP: preserve aspect ratio of images

This commit is contained in:
Antonio Scandurra 2023-11-28 17:32:27 +01:00
parent 600b564bbf
commit 3ac545088a
4 changed files with 87 additions and 58 deletions

View file

@ -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())
}