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>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 07:58:27 -04:00
1 parent 7d493b669b
commit c04c67d39a
32 files changed
+3118 -18

No files matched your search

+6 -6
View File
@@ -13,15 +13,15 @@ use crate::{
};
/// The tools demo's drawing: its shapes, what is selected, the tool and brush, the view, and each step with the shapes after it.
struct Studio {
shapes: Vec<Shape>,
selected: Vec<SharedString>,
pub(super) struct Studio {
pub(super) shapes: Vec<Shape>,
pub(super) selected: Vec<SharedString>,
tool: Tool,
brush: Brush,
view: Viewport,
steps: Vec<(SharedString, Vec<Shape>)>,
at: usize,
made: usize,
pub(super) made: usize,
}
impl Studio {
@@ -61,14 +61,14 @@ impl Studio {
}
/// Keeps the shapes as a new step, dropping any steps undone.
fn record(&mut self, words: String) {
pub(super) fn record(&mut self, words: String) {
self.steps.truncate(self.at);
self.steps.push((words.into(), self.shapes.clone()));
self.at = self.steps.len();
}
}
fn studio(window: &mut Window, cx: &mut App) -> Entity<Studio> {
pub(super) fn studio(window: &mut Window, cx: &mut App) -> Entity<Studio> {
keep("canvas-studio", Studio::new, window, cx)
}