A new chapter, src/media. ImageViewer fits a picture to its stage and zooms by the document steps, by keys, buttons and Cmd-scroll about the pointer; a drag through gpui's drag, a scroll or the arrows pan it once it overhangs; R turns it a quarter at a time. gpui paints pictures without a transform, so media::turn turns the decoded frames off the main thread, an asset keyed by the picture and the turn; `image` 0.25, which gpui already decodes with, is now a dependency. ImageThumbnail shows a picture in its own shape with a corner label and a ring when chosen, and is a Tab stop only with a handler. Lightbox / Gallery Viewer points to overlays::Lightbox, which the gallery opens from the thumbnails. T26 splits into T26a–e. AGENTS.md: the drag rule says drags that pan, turn or slide go through gpui's drag; pictures turn by their pixels.
78 lines
1.3 KiB
Rust
78 lines
1.3 KiB
Rust
mod agent;
|
|
mod buttons;
|
|
mod charts;
|
|
mod chat;
|
|
mod collab;
|
|
mod data;
|
|
mod debug;
|
|
mod documents;
|
|
mod editor;
|
|
mod feedback;
|
|
mod finance;
|
|
mod forms;
|
|
mod generative;
|
|
mod git;
|
|
mod layout;
|
|
mod lists;
|
|
mod media;
|
|
mod menus;
|
|
mod motion;
|
|
mod navigation;
|
|
mod overlays;
|
|
mod primitives;
|
|
mod shell;
|
|
mod tables;
|
|
mod terminal;
|
|
mod theme;
|
|
mod typography;
|
|
|
|
use gpui::{AnyElement, App, Window};
|
|
|
|
use crate::script::Step;
|
|
|
|
pub struct Page {
|
|
pub number: u8,
|
|
pub slug: &'static str,
|
|
pub title: &'static str,
|
|
pub summary: &'static str,
|
|
pub render: fn(&mut Window, &mut App) -> AnyElement,
|
|
/// Interactions shot after the static pages.
|
|
pub script: &'static [Step],
|
|
}
|
|
|
|
pub const ALL: &[Page] = &[
|
|
primitives::PAGE,
|
|
typography::PAGE,
|
|
layout::PAGE,
|
|
shell::PAGE,
|
|
buttons::PAGE,
|
|
forms::PAGE,
|
|
navigation::PAGE,
|
|
menus::PAGE,
|
|
overlays::PAGE,
|
|
feedback::PAGE,
|
|
motion::PAGE,
|
|
data::PAGE,
|
|
lists::PAGE,
|
|
tables::PAGE,
|
|
charts::PAGE,
|
|
finance::PAGE,
|
|
editor::PAGE,
|
|
terminal::PAGE,
|
|
git::PAGE,
|
|
debug::PAGE,
|
|
documents::PAGE,
|
|
collab::PAGE,
|
|
chat::PAGE,
|
|
agent::PAGE,
|
|
generative::PAGE,
|
|
media::PAGE,
|
|
theme::PAGE,
|
|
];
|
|
|
|
pub use shell::{open_about, open_managed};
|
|
|
|
pub fn find(slug: &str) -> Option<usize> {
|
|
ALL.iter().position(|page| page.slug == slug)
|
|
}
|