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: Add `aspect-ratio` builder method to `Styled` (#48751)

Sebastian Kootzefc6b0ce70f1
diff --git a/crates/gpui/src/styled.rs b/crates/gpui/src/styled.rs
index 3d0b86a9523..f83e9103572 100644
--- a/crates/gpui/src/styled.rs
+++ b/crates/gpui/src/styled.rs
@@ -384,6 +384,20 @@ pub trait Styled: Sized {
self
}
+ /// Sets the aspect ratio of the element.
+ /// [Docs](https://tailwindcss.com/docs/aspect-ratio)
+ fn aspect_ratio(mut self, ratio: f32) -> Self {
+ self.style().aspect_ratio = Some(ratio);
+ self
+ }
+
+ /// Sets the aspect ratio of the element to 1/1 – equal width and height.
+ /// [Docs](https://tailwindcss.com/docs/aspect-ratio)
+ fn aspect_square(mut self) -> Self {
+ self.style().aspect_ratio = Some(1.0);
+ self
+ }
+
/// Sets the background color of the element.
fn bg<F>(mut self, fill: F) -> Self
where