gpui-kit GitHub

Components

AspectRatio builder

A container whose two dimensions stay in a fixed ratio.

A builder is RenderOnce. Construct and mount it in one expression.

use gpui_kit::layout::AspectRatio;

Construct

new(ident: impl Into<Ident>, ratio: f32) -> Self
of(ident: impl Into<Ident>, width: f32, height: f32) -> Self

Options

Chain onto the value.

fit(fit: AspectFit) -> Self
width_driven() -> Self
height_driven() -> Self
child(child: impl IntoElement) -> Self

Queries

Only answer; they change nothing.

ratio() -> f32

Rendered by

Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.

Source: crates/gpui-kit/src/layout/aspect_ratio.rs