Add general-purpose functions for sizing in viewport units (#3833)
This PR adds general-purpose functions for obtaining a `Length` in viewport units. Previously in #3600 we had added specific variants of `w` and `h` that took viewport units, but I think it makes more sense to just have a primitive that can compose with any styling method that accepts a `Length` or `Into<Length>`. Release Notes: - N/A
This commit is contained in:
parent
8ba52b839f
commit
0f33775a91
6 changed files with 23 additions and 23 deletions
|
@ -13,16 +13,16 @@ impl Render for ViewportUnitsStory {
|
|||
.flex_row()
|
||||
.child(
|
||||
div()
|
||||
.w_vw(0.5, cx)
|
||||
.h_vh(0.8, cx)
|
||||
.w(vw(0.5, cx))
|
||||
.h(vh(0.8, cx))
|
||||
.bg(gpui::red())
|
||||
.text_color(gpui::white())
|
||||
.child("50vw, 80vh"),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.w_vw(0.25, cx)
|
||||
.h_vh(0.33, cx)
|
||||
.w(vw(0.25, cx))
|
||||
.h(vh(0.33, cx))
|
||||
.bg(gpui::green())
|
||||
.text_color(gpui::white())
|
||||
.child("25vw, 33vh"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue