Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: fix #9931 img object-fit regression (#10006)

Matthias Grandlb1ccead0f66a
diff --git a/crates/gpui/src/elements/img.rs b/crates/gpui/src/elements/img.rs
index cb41010cf61..e02146e29c5 100644
--- a/crates/gpui/src/elements/img.rs
+++ b/crates/gpui/src/elements/img.rs
@@ -239,7 +239,8 @@ impl Element for Img {
let corner_radii = style.corner_radii.to_pixels(bounds.size, cx.rem_size());
if let Some(data) = source.data(cx) {
- cx.paint_image(bounds, corner_radii, data.clone(), self.grayscale)
+ let new_bounds = self.object_fit.get_bounds(bounds, data.size());
+ cx.paint_image(new_bounds, corner_radii, data.clone(), self.grayscale)
.log_err();
}