T26a Media: images
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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4678773383
commit
f8a51a5352
14 files changed
+1171
-7
No files matched your search
@@ -0,0 +1,40 @@
|
||||
mod images;
|
||||
|
||||
use gpui::{AnyElement, App, IntoElement, ParentElement, Window, div};
|
||||
|
||||
use super::Page;
|
||||
use crate::script::Step;
|
||||
|
||||
pub const PAGE: Page = Page {
|
||||
number: 26,
|
||||
slug: "media",
|
||||
title: "Media",
|
||||
summary: "Pictures, video and sound: looking closely, cropping and marking up, playing, and the controls and devices around them.",
|
||||
render,
|
||||
script: SCRIPT,
|
||||
};
|
||||
|
||||
const SCRIPT: &[Step] = &[
|
||||
Step::DownAt("media-viewer", 320.0, 240.0),
|
||||
Step::UpAt("media-viewer", 320.0, 240.0),
|
||||
Step::Key("="),
|
||||
Step::Key("="),
|
||||
Step::Wait(300),
|
||||
Step::Shot("zoomed"),
|
||||
Step::Key("r"),
|
||||
Step::Wait(500),
|
||||
Step::Shot("turned"),
|
||||
Step::DownAt("media-thumbs", 237.0, 50.0),
|
||||
Step::UpAt("media-thumbs", 237.0, 50.0),
|
||||
Step::Wait(500),
|
||||
Step::Shot("lightbox"),
|
||||
Step::Key("escape"),
|
||||
Step::Wait(300),
|
||||
];
|
||||
|
||||
fn render(window: &mut Window, cx: &mut App) -> AnyElement {
|
||||
div()
|
||||
.child(images::viewer(cx))
|
||||
.child(images::thumbnails(window, cx))
|
||||
.into_any_element()
|
||||
}
|
||||
Reference in new issue
Block a user