Expand description
Thumbnails and a virtualised grid of them, from images the
application supplies (a texture and its size), with a flat
placeholder in the image’s average colour until the image is there:
no spinner per thumbnail. In this layer so that both the image tools
(egui_pop_viewport::thumbnail re-exports it) and the file picker of
the application API can draw them.
Experimental: may change in any release
(docs/stability.md).
use egui_pop_core::thumbnail::{Thumbnail, thumbnail_grid};
fn ui(ui: &mut egui::Ui, selected: &mut usize) {
thumbnail_grid(ui, 10_000, egui::vec2(96.0, 72.0), |ui, i| {
let r = ui.add(
Thumbnail::new(format!("Image {i}"))
.placeholder(egui::Color32::from_gray(90))
.selected(i == *selected),
);
if r.clicked() {
*selected = i;
}
});
}Structs§
- Band
- A rubber band dragged across a grid (
ThumbnailGrid::rubber_band). - Grid
Output - What a
ThumbnailGriddrawn withThumbnailGrid::show_with_bandtells. - Thumbnail
- One thumbnail.
- Thumbnail
Grid thumbnail_gridwith its options: where it keeps its scrolling, how high it gets, and a cell to bring into view, drawn or not.
Enums§
- Grid
Resize - How a thumbnail grid’s zoom answers a resize: what the zoom (its
slider,
Ctrland+or-,Ctrland the wheel) means, and so what a wider grid shows.
Constants§
- BAND_
MIN - How far the pointer moves before a drag draws a rubber band: a click is not a band.
Functions§
- caption_
height - The room
Thumbnail::captiontakes under the image, in points. - cells_
in - The cells of a grid
per_rowwide thatrecttouches,rectin the grid’s own coordinates (its first cell’s corner at the origin), each cellcelllarge,gapapart in a row andpitchfrom one row’s top to the next’s. - fitted
- The largest rectangle of aspect
w:hinsideouter, centred. - thumbnail_
grid - A virtualised grid: only the rows in view are built, so ten thousand
thumbnails cost what a screenful does.
itemdraws celli.