Files
Ely-GPUI-Components/examples/gallery/pages/canvas/mod.rs
T
ZacharyZhang-NYandClaude Opus 5.5 c04c67d39a Canvas · Panels: layers, inspector, alignment, assets, style and layout editors
LayerPanel lists the canvas's layers topmost first on lists::Tree: a box
shows or hides each, F2 renames, a drag restacks into a new paint order.
InspectorPanel edits the one selected shape's frame, fill, visibility and
lock. AlignmentToolbar lines up or spreads the selection through
`aligned`. AssetPanel finds shapes by name in a picks grid, each drawn
to fit its tile. ColorPanel, ShadowEditor, BorderEditor and
TypographyPanel edit a look; GradientPanel is forms::GradientEditor.
ConstraintsEditor pins a shape to its frame, with `Constraints::placed`;
AutoLayoutControls sets flow, gap, padding and a place grid, with
`AutoLayout::laid`; ExportPanel names each file once. The panels share
`canvas::panel`: editing, pair, caption, heading and color_well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 07:58:27 -04:00

52 lines
1.4 KiB
Rust

use gpui::{AnyElement, App, Window, div, prelude::*};
mod looks;
mod panels;
mod plane;
mod tools;
use super::Page;
use crate::script::Step;
pub const PAGE: Page = Page {
number: 32,
slug: "canvas",
title: "Canvas & Design",
summary: "An endless plane to lay work on, the tools and panels around it, and graphs of nodes.",
render,
script: SCRIPT,
};
const SCRIPT: &[Step] = &[
Step::DownAt("canvas-plane", 420.0, 300.0),
Step::DragTo("canvas-plane", 300.0, 240.0),
Step::UpAt("canvas-plane", 300.0, 240.0),
Step::Wait(200),
Step::Shot("panned"),
Step::DownAt("canvas-tools", 150.0, 110.0),
Step::DragTo("canvas-tools", 170.0, 112.0),
Step::DragTo("canvas-tools", 187.0, 112.0),
Step::Wait(200),
Step::Shot("snapping"),
Step::UpAt("canvas-tools", 187.0, 112.0),
Step::Wait(200),
Step::DownAt("canvas-palette", 83.0, 16.0),
Step::UpAt("canvas-palette", 83.0, 16.0),
Step::Wait(150),
Step::DownAt("canvas-tools", 60.0, 230.0),
Step::DragTo("canvas-tools", 200.0, 300.0),
Step::UpAt("canvas-tools", 200.0, 300.0),
Step::Wait(250),
Step::Shot("drawn"),
];
fn render(window: &mut Window, cx: &mut App) -> AnyElement {
div()
.child(plane::plane(window, cx))
.child(tools::tools(window, cx))
.child(panels::arrange(window, cx))
.child(looks::styles(window, cx))
.child(looks::rules(window, cx))
.into_any_element()
}