gpui-kit GitHub

Components

ImageViewer builder

A framed viewer for one image at a time.

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

use gpui_kit::content::ImageViewer;

Construct

new(ident: impl Into<Ident>, frames: impl IntoIterator<Item = ImageFrame>) -> Self

Options

Chain onto the value.

showing(id: impl Into<SharedString>) -> Self
fit(fit: FitMode) -> Self
zoom_range(min: f32, max: f32) -> Self
height(height: f32) -> Self
image(supplier: impl Fn(&ImageFrame, &mut Window, &mut App) -> Option<AnyElement> + 'static) -> Self
on_event(handler: impl Fn(&ImageViewerEvent, &mut Window, &mut App) + 'static) -> Self

Reports

The variants of the event it emits. It never applies the change itself.

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/content/image_viewer.rs