Merge outside PR #578: feat(engine): Match Size and Space Evenly in Align (#566)

# Conflicts:
#	ATTRIBUTION.md
#	crates/engine/src/tests.rs
#	docs/guide/reference/commands.md
#	src/icons.rs
This commit is contained in:
Tanish Manku committed 2026-11-24 15:14:54 -07:00
commit 478e7e6976
15 files changed
+201 -8

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ shaders or SDK code).
| Hack Regular (via `epaint_default_fonts`) | UI monospace font | Source Foundry Authors; Bitstream (Vera) | <https://github.com/source-foundry/Hack> | MIT + Bitstream Vera licence, [`licenses/fonts/LICENSE-Hack.txt`](licenses/fonts/LICENSE-Hack.txt) |
| Noto Emoji (via `epaint_default_fonts`) | Symbol fallback | Google | <https://github.com/googlefonts/noto-emoji> | SIL OFL 1.1, [`licenses/fonts/OFL-1.1-NotoEmoji.txt`](licenses/fonts/OFL-1.1-NotoEmoji.txt) |
| emoji-icon-font (via `epaint_default_fonts`) | Symbol fallback | John Slegers | <https://github.com/jslegers/emoji-icon-font> | MIT, [`licenses/fonts/LICENSE-emoji-icon-font.txt`](licenses/fonts/LICENSE-emoji-icon-font.txt) |
| `assets/icons/anicraft-*.svg` (37 files: align, distribute, layer, the parenting view, view only the active layer, mask and masked layer, width tool, gradient transform tool, camera, brush, paint brush, eraser, eyedropper, muted sound, magnet, bone, bind, asset warp, edit multiple frames, insert frame, keyframe and blank keyframe, clip to the stage, and seven panel icons: properties, swatches, library, explorer, history, output, actions) | Align panel, layer-type, the timeline's Parenting View and View Only the Active Layer toggles, Width tool, Gradient Transform tool, Camera, Brush, Paint Brush, Eraser, Eyedropper, Bone, Bind and Asset Warp tool icons, the timeline's mute toggle, Snap to Objects, Edit Multiple Frames, the timeline's Insert Frame / Keyframe / Blank Keyframe buttons, Clip Content Outside the Stage, panel icons in docks collapsed to icons (ADR 0087) | AniCraft contributors | Original work, drawn on Lucide's 24-unit grid and stroke style (the muted sound keeps the speaker of Lucide's `volume-2`, ISC, crossed out) | MIT OR Apache-2.0 |
| `assets/icons/anicraft-*.svg` (42 files: align, distribute, match size, space evenly, layer, the parenting view, view only the active layer, mask and masked layer, width tool, gradient transform tool, camera, brush, paint brush, eraser, eyedropper, muted sound, magnet, bone, bind, asset warp, edit multiple frames, insert frame, keyframe and blank keyframe, clip to the stage, and seven panel icons: properties, swatches, library, explorer, history, output, actions) | Align panel, layer-type, the timeline's Parenting View and View Only the Active Layer toggles, Width tool, Gradient Transform tool, Camera, Brush, Paint Brush, Eraser, Eyedropper, Bone, Bind and Asset Warp tool icons, the timeline's mute toggle, Snap to Objects, Edit Multiple Frames, the timeline's Insert Frame / Keyframe / Blank Keyframe buttons, Clip Content Outside the Stage, panel icons in docks collapsed to icons (ADR 0087) | AniCraft contributors | Original work, drawn on Lucide's 24-unit grid and stroke style (the muted sound keeps the speaker of Lucide's `volume-2`, ISC, crossed out) | MIT OR Apache-2.0 |
| `crates/svg/fixtures/clips-masks-text.svg` | SVG import test drawing (clip paths, a mask, text) | AniCraft contributors | Original work | MIT OR Apache-2.0 |
| `crates/svg/fixtures/soft-masks-text-paths.svg` | SVG import test drawing (an alpha and a luminance mask, text on a path) | AniCraft contributors | Original work | MIT OR Apache-2.0 |
| `assets/icons/*.svg` except `anicraft-*` (37 files: tools, transport, layer toggles, folders, guide, image, text, sound, chevrons, plus, trash, copy, ellipsis) | UI icons, stroked by `src/icons.rs` | Lucide Icons and Contributors (some derived from Feather by Cole Bemis) | <https://github.com/lucide-icons/lucide> (`icons/<name>.svg`), copied unchanged from the PhotoCraft sibling project's set (`volume-2.svg` from Lucide 0.512.0; `plus.svg`, `trash.svg`, `copy.svg` and `ellipsis.svg` from Lucide's `main` branch, 2026-11) | ISC (Lucide) and MIT (Feather), [`licenses/icons/LICENSE-lucide.txt`](licenses/icons/LICENSE-lucide.txt) |
+7
View File
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M4 4v16" />
<path d="M2 7l2-3 2 3" />
<path d="M2 17l2 3 2-3" />
<rect x="9" y="4" width="4" height="16" rx="1" />
<rect x="16" y="4" width="5" height="16" rx="1" />
</svg>

After

Width:  |  Height:  |  Size: 374 B

+6
View File
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="8" height="8" rx="1" />
<rect x="13" y="13" width="8" height="8" rx="1" />
<path d="M14 4h6v6" />
<path d="M4 14v6h6" />
</svg>

After

Width:  |  Height:  |  Size: 343 B

+7
View File
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M4 4h16" />
<path d="M7 2l-3 2 3 2" />
<path d="M17 2l3 2-3 2" />
<rect x="4" y="9" width="16" height="4" rx="1" />
<rect x="4" y="16" width="16" height="5" rx="1" />
</svg>

After

Width:  |  Height:  |  Size: 375 B

+7
View File
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="2" y="5" width="4" height="10" rx="1" />
<rect x="10" y="5" width="4" height="10" rx="1" />
<rect x="18" y="5" width="4" height="10" rx="1" />
<path d="M7 19h2" />
<path d="M15 19h2" />
</svg>

After

Width:  |  Height:  |  Size: 394 B

+7
View File
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="2" width="10" height="4" rx="1" />
<rect x="5" y="10" width="10" height="4" rx="1" />
<rect x="5" y="18" width="10" height="4" rx="1" />
<path d="M19 7v2" />
<path d="M19 15v2" />
</svg>

After

Width:  |  Height:  |  Size: 394 B

+68
View File
@@ -56,6 +56,11 @@ pub fn specs() -> Vec<CommandSpec> {
c("align.bottom", "Bottom", "Modify/Align", Some("Ctrl+Alt+6"), "{to_stage?}", true, |s, p| align(s, p, Edge::Bottom)),
c("align.distribute_h", "Distribute Horizontal Centers", "Modify/Align", None, "{}", true, |s, _| distribute(s, true)),
c("align.distribute_v", "Distribute Vertical Centers", "Modify/Align", None, "{}", true, |s, _| distribute(s, false)),
c("align.match_width", "Match Width", "Modify/Align", None, "{to_stage?} sets each selected object's width to the widest one's (to_stage: the stage's width), keeping its height and its left edge; an object with no width (a vertical line) keeps none", true, |s, p| match_size(s, p, true, false)),
c("align.match_height", "Match Height", "Modify/Align", None, "{to_stage?} sets each selected object's height to the tallest one's (to_stage: the stage's height), keeping its width and its top edge; an object with no height (a horizontal line) keeps none", true, |s, p| match_size(s, p, false, true)),
c("align.match_size", "Match Width and Height", "Modify/Align", None, "{to_stage?} sets each selected object's width to the widest one's and its height to the tallest one's, which may be two different objects (to_stage: the stage's width and height), keeping its top-left corner; a side an object has no extent along stays as it is", true, |s, p| match_size(s, p, true, true)),
c("align.space_h", "Space Evenly Horizontally", "Modify/Align", None, "{} moves the selected objects (three or more) so the gaps between them across are equal; the first and last (by their left edges) stay where they are. Refused when the objects overlap too much to keep their order", true, |s, _| space(s, true)),
c("align.space_v", "Space Evenly Vertically", "Modify/Align", None, "{} moves the selected objects (three or more) so the gaps between them down are equal; the first and last (by their top edges) stay where they are. Refused when the objects overlap too much to keep their order", true, |s, _| space(s, false)),
]
}
@@ -731,6 +736,69 @@ fn align(s: &mut Session, p: &Value, edge: Edge) -> Result<Value> {
Ok(json!({"moved": n, "to_stage": to_stage}))
}
/// Match Size (#566): each selected object (a raw drawing as one, as align takes them) scaled
/// about its top-left corner to the largest one's width and/or height, or the stage's.
/// Objects with no extent along a matched side (a straight line along the other) keep it.
fn match_size(s: &mut Session, p: &Value, width: bool, height: bool) -> Result<Value> {
let units = selected_units(s);
if units.is_empty() {
return Err(EngineError::State("nothing is selected".into()));
}
let to_stage = opt_bool(p, "to_stage")?.unwrap_or(false);
let (w, h) = if to_stage {
(s.doc.stage.width as f32, s.doc.stage.height as f32)
} else {
units.iter().fold((0.0f32, 0.0f32), |(w, h), (_, b)| (w.max(b.width()), h.max(b.height())))
};
const MIN: f32 = 1e-3;
let mut by: std::collections::HashMap<Item, Affine> = std::collections::HashMap::new();
for (items, b) in units {
let sx = if width && b.width() > MIN { w / b.width() } else { 1.0 };
let sy = if height && b.height() > MIN { h / b.height() } else { 1.0 };
let m = Affine::translate(b.min.x, b.min.y).mul(&Affine::scale(sx, sy)).mul(&Affine::translate(-b.min.x, -b.min.y));
by.extend(items.into_iter().map(|i| (i, m)));
}
s.each_layer(true, |s| {
let layer = s.layer;
Ok(json!({"transformed": apply_each(s, |id| by.get(&(layer, id)).copied().unwrap_or(Affine::IDENTITY))?}))
})
}
/// Space Evenly (#566): the objects between the first and the last (by their left or top
/// edges) move so every gap between neighbours is the same; the outer two stay put.
fn space(s: &mut Session, horizontal: bool) -> Result<Value> {
let mut units = selected_units(s);
if units.len() < 3 {
return Err(EngineError::State("select at least three elements to space evenly".into()));
}
// Where an object starts along the axis, and how long it is.
let lo = |b: &Rect| if horizontal { (b.min.x, b.width()) } else { (b.min.y, b.height()) };
units.sort_by(|a, b| lo(&a.1).0.total_cmp(&lo(&b.1).0));
let (Some(first), Some(last)) = (units.first(), units.last()) else { return Ok(json!({"moved": 0})) };
let (start, _) = lo(&first.1);
let (last_at, last_len) = lo(&last.1);
// In f64, so rounding doesn't add up over many objects and move the last one.
let end = f64::from(last_at) + f64::from(last_len);
let total: f64 = units.iter().map(|u| f64::from(lo(&u.1).1)).sum();
let gap = (end - f64::from(start) - total) / (units.len() - 1) as f64;
// A gap so negative that an object would pass the next one (one long object over short
// ones) has no even spacing that keeps their order: refuse rather than shuffle them.
if units.iter().take(units.len() - 1).any(|u| f64::from(lo(&u.1).1) + gap < 0.0) {
return Err(EngineError::State("these objects overlap too much to space evenly in their order".into()));
}
let mut at = f64::from(start);
let mut moves: Vec<(Item, Vec2)> = Vec::new();
for (items, b) in &units {
let (l, n) = lo(b);
let d = (at - f64::from(l)) as f32;
let d = if horizontal { Vec2::new(d, 0.0) } else { Vec2::new(0.0, d) };
moves.extend(items.iter().map(|id| (*id, d)));
at += f64::from(n) + gap;
}
let n = translate_each(s, &moves)?;
Ok(json!({"moved": n}))
}
fn distribute(s: &mut Session, horizontal: bool) -> Result<Value> {
let mut units = selected_units(s);
if units.len() < 3 {
+55
View File
@@ -347,6 +347,61 @@ fn distribute_to_layers_gives_each_object_its_own_layer() {
assert!(e.to_string().contains("tweened"), "{e}");
}
/// #566: Match Size makes every selected object the largest one's size (or the stage's),
/// each keeping its top-left corner; Space Evenly makes the gaps between neighbours equal,
/// leaving the outer two where they are.
#[test]
fn match_size_and_space_evenly() {
let mut s = Session::default();
for (x, y, w, h) in [(10, 50, 20, 40), (200, 10, 60, 10), (90, 120, 30, 30)] {
run(&mut s, "draw.rect", json!({"x": x, "y": y, "w": w, "h": h, "stroke": null}));
}
run(&mut s, "edit.select_all", json!({}));
let boxes = |s: &Session| s.selection.ids().map(|id| s.element_bounds(id)).collect::<Vec<_>>();
let before = boxes(&s);
run(&mut s, "align.match_width", json!({}));
let after = boxes(&s);
let widest = before.iter().map(|b| b.width()).fold(0.0, f32::max);
for (a, b) in after.iter().zip(&before) {
assert!((a.width() - widest).abs() < 1e-3 && (a.height() - b.height()).abs() < 1e-3, "as wide as the widest, as tall as before: {a:?}");
assert!((a.min - b.min).length() < 1e-3, "the left and top edges stay");
}
run(&mut s, "align.match_size", json!({"to_stage": true}));
let (w, h) = (s.doc.stage.width as f32, s.doc.stage.height as f32);
assert!(boxes(&s).iter().all(|b| (b.width() - w).abs() < 1e-2 && (b.height() - h).abs() < 1e-2), "the stage's size");
run(&mut s, "edit.undo", json!({}));
run(&mut s, "edit.undo", json!({}));
// Space evenly: equal gaps between neighbours across, the outer two unmoved.
run(&mut s, "align.space_h", json!({}));
let mut b = boxes(&s);
b.sort_by(|p, q| p.min.x.total_cmp(&q.min.x));
let gaps: Vec<f32> = b.windows(2).map(|w| w[1].min.x - w[0].max.x).collect();
assert!((gaps[0] - gaps[1]).abs() < 1e-3, "{gaps:?}");
let mut was = before.clone();
was.sort_by(|p, q| p.min.x.total_cmp(&q.min.x));
assert!((b[0].min.x - was[0].min.x).abs() < 1e-3 && (b[2].max.x - was[2].max.x).abs() < 1e-3, "the outer two stay");
run(&mut s, "align.space_v", json!({}));
let mut b = boxes(&s);
b.sort_by(|p, q| p.min.y.total_cmp(&q.min.y));
let gaps: Vec<f32> = b.windows(2).map(|w| w[1].min.y - w[0].max.y).collect();
assert!((gaps[0] - gaps[1]).abs() < 1e-3, "{gaps:?}");
// Two objects have no gap between others to share.
run(&mut s, "edit.deselect", json!({}));
let ids: Vec<u64> = s.visible_elements().iter().take(2).map(|e| e.id.0).collect();
run(&mut s, "element.select", json!({"ids": ids}));
assert!(s.execute("align.space_h", &json!({})).is_err());
// One long object over two short ones: no even spacing keeps their order, so nothing moves.
let mut s = Session::default();
for (x, w) in [(0, 200), (20, 20), (80, 20)] {
run(&mut s, "draw.rect", json!({"x": x, "y": 0, "w": w, "h": 10, "stroke": null, "object": true}));
}
run(&mut s, "edit.select_all", json!({}));
let before = boxes(&s);
assert!(s.execute("align.space_h", &json!({})).is_err());
assert_eq!(boxes(&s), before);
}
/// #301, #297: a raw rectangle (one fill and one stroke per side, ADR 0042) aligns, distributes,
/// turns and scales as one shape, so its outline stays on its fill.
#[test]
+7 -1
View File
@@ -545,7 +545,13 @@ Use the **Align** panel in the right-hand dock, or **Modify › Align**: **Left*
(**Ctrl+Alt+1**), **Horizontal Center** (**Ctrl+Alt+2**), **Right** (**Ctrl+Alt+3**), **Top**
(**Ctrl+Alt+4**), **Vertical Center** (**Ctrl+Alt+5**) and **Bottom** (**Ctrl+Alt+6**).
**Distribute Horizontal Centers** and **Distribute Vertical Centers** space three or more
things evenly. Tick **To stage** in the Align panel (or press **Ctrl+Alt+8**) to align to the
things evenly by their centres; **Space Evenly Horizontally** and **Space Evenly Vertically**
make the gaps between them equal instead, leaving the outer two where they are (things that
overlap too much to keep their order are left as they are). **Match Width** gives every
selected thing the width of the widest one and **Match Height** the height of the tallest,
each keeping its other side; **Match Width and Height** does both, so the width and the height
can come from two different things. With **To stage** they use the stage's width and height.
Each thing keeps its top-left corner, and a straight line keeps its zero width or height. Tick **To stage** in the Align panel (or press **Ctrl+Alt+8**) to align to the
stage instead of the selection. A single shape always aligns to the stage. Align works across
layers.
+2 -2
View File
@@ -68,7 +68,7 @@ not this table, says what matters most.
| Timeline panel | **done** | See Timeline. |
| Library panel | **done** | See Symbols and Library. |
| Colour and Swatches panels | **done** | See Colour. |
| Align panel | **done** | Align, distribute, To Stage. Missing: Match Size and Space (P-017). |
| Align panel | **done** | Align, distribute, space evenly, match size, To Stage. |
| Transform and Info panels | **partial** | Position, scale, rotation, skew and the transformation point are rows in Properties; there is no separate Transform panel with Duplicate and Transform, and no Info panel with the pointer's colour and position (P-050). |
| History panel | **done** | With saved commands ([ADR 0097](adr/0097-command-macros.md)). |
| Scene panel | **done** | A scene menu on the edit bar and Modify › Scene ([ADR 0011](adr/0011-scenes.md)). |
@@ -143,7 +143,7 @@ not this table, says what matters most.
| Combine Objects: Union, Intersect, Punch, Crop | **done** | [ADR 0073](adr/0073-groups-combine-objects-and-selection-modifiers.md). One layer at a time. |
| Arrange (front, back, forward, backward) | **done** | |
| Align, distribute | **done** | |
| Match Size, Space evenly | **missing** | P-017. |
| Match Size, Space evenly | **done** | `align.match_width`, `align.match_height`, `align.match_size`, `align.space_h`, `align.space_v` (#566). |
| Transform: rotate 90°, flip, remove transform, scale and rotate by numbers | **done** | |
| Envelope | **done** | [ADR 0080](adr/0080-drawing-parity-leftovers.md). Shapes and drawing objects only. |
| Distort | **missing** | P-020. |
+1 -1
View File
@@ -61,7 +61,7 @@ the changelog.
| Id | Goal | Parity area | Size | Needs | Lane |
|---|---|---|---|---|---|
| P-017 | Selecting as in the reference app: a marquee takes instances, groups and objects it touches ([#522](https://github.com/storytold/anicraft/issues/522)); Hide Edges ([#298](https://github.com/storytold/anicraft/issues/298)); a first-use hint that a fill and its outline are separate, with double-click selecting both ([#484](https://github.com/storytold/anicraft/issues/484), [#485](https://github.com/storytold/anicraft/issues/485), [#343](https://github.com/storytold/anicraft/issues/343)); Match Size and Space in Align | Tools, drawing model | S each | | stage |
| P-017 | Selecting as in the reference app: a marquee takes instances, groups and objects it touches ([#522](https://github.com/storytold/anicraft/issues/522)); Hide Edges ([#298](https://github.com/storytold/anicraft/issues/298)); a first-use hint that a fill and its outline are separate, with double-click selecting both ([#484](https://github.com/storytold/anicraft/issues/484), [#485](https://github.com/storytold/anicraft/issues/485), [#343](https://github.com/storytold/anicraft/issues/343)) | Tools, drawing model | S each | | stage |
| P-018 | Lasso, Polygon and Magic Wand tools ([#515](https://github.com/storytold/anicraft/issues/515)) | Tools | M | | stage |
| P-019 | Text is typed in its block on the stage, in its real font and alignment ([#303](https://github.com/storytold/anicraft/issues/303)) | Text | L | | text |
| P-020 | Modify › Shape: Smooth, Straighten, Advanced Smooth and Optimize ([#510](https://github.com/storytold/anicraft/issues/510)); Distort; oval angles and primitive shapes | Drawing model | M | | geom |
+21 -1
View File
@@ -53,6 +53,11 @@ pub enum Icon {
AlignBottom,
DistributeH,
DistributeV,
MatchWidth,
MatchHeight,
MatchSize,
SpaceH,
SpaceV,
Mask,
Masked,
Folder,
@@ -94,7 +99,7 @@ pub enum Icon {
impl Icon {
#[cfg(test)]
pub const ALL: [Icon; 76] = [
pub const ALL: [Icon; 81] = [
Icon::PanelProperties,
Icon::PanelSwatches,
Icon::PanelLibrary,
@@ -140,6 +145,11 @@ impl Icon {
Icon::AlignBottom,
Icon::DistributeH,
Icon::DistributeV,
Icon::MatchWidth,
Icon::MatchHeight,
Icon::MatchSize,
Icon::SpaceH,
Icon::SpaceV,
Icon::Select,
Icon::Subselect,
Icon::Transform,
@@ -241,6 +251,11 @@ impl Icon {
Icon::AlignBottom => ("anicraft-align-bottom", false),
Icon::DistributeH => ("anicraft-distribute-h", false),
Icon::DistributeV => ("anicraft-distribute-v", false),
Icon::MatchWidth => ("anicraft-match-width", false),
Icon::MatchHeight => ("anicraft-match-height", false),
Icon::MatchSize => ("anicraft-match-size", false),
Icon::SpaceH => ("anicraft-space-h", false),
Icon::SpaceV => ("anicraft-space-v", false),
// Layer types: a stencil (mask) and the area inside it (masked).
Icon::Mask => ("anicraft-mask", false),
Icon::Masked => ("anicraft-masked", false),
@@ -337,6 +352,11 @@ static FILES: &[(&str, &str)] = &[
("anicraft-align-bottom", include_str!("../assets/icons/anicraft-align-bottom.svg")),
("anicraft-distribute-h", include_str!("../assets/icons/anicraft-distribute-h.svg")),
("anicraft-distribute-v", include_str!("../assets/icons/anicraft-distribute-v.svg")),
("anicraft-match-width", include_str!("../assets/icons/anicraft-match-width.svg")),
("anicraft-match-height", include_str!("../assets/icons/anicraft-match-height.svg")),
("anicraft-match-size", include_str!("../assets/icons/anicraft-match-size.svg")),
("anicraft-space-h", include_str!("../assets/icons/anicraft-space-h.svg")),
("anicraft-space-v", include_str!("../assets/icons/anicraft-space-v.svg")),
("anicraft-mask", include_str!("../assets/icons/anicraft-mask.svg")),
("anicraft-width", include_str!("../assets/icons/anicraft-width.svg")),
("anicraft-gradient-transform", include_str!("../assets/icons/anicraft-gradient-transform.svg")),
+1 -1
View File
@@ -483,7 +483,7 @@ pub fn enabled(app: &App, id: &str) -> Option<bool> {
let sel = !app.onion_ui.sel.is_empty();
match id {
"edit.delete" | "edit.cut" | "edit.copy" => Some(sel),
"edit.duplicate" | "modify.convert_to_symbol" | "modify.break_apart" | "arrange.bring_to_front" | "arrange.send_to_back" | "align.distribute_h" | "align.distribute_v" => Some(false),
"edit.duplicate" | "modify.convert_to_symbol" | "modify.break_apart" | "arrange.bring_to_front" | "arrange.send_to_back" | "align.distribute_h" | "align.distribute_v" | "align.space_h" | "align.space_v" | "align.match_width" | "align.match_height" | "align.match_size" => Some(false),
_ => None,
}
}
+10
View File
@@ -696,6 +696,16 @@ pub(crate) fn align_panel(app: &mut App, ui: &mut egui::Ui) {
ui.spacing_mut().item_spacing.x = 2.0;
button(app, ui, Icon::DistributeH, "align.distribute_h");
button(app, ui, Icon::DistributeV, "align.distribute_v");
ui.add_space(10.0);
button(app, ui, Icon::SpaceH, "align.space_h");
button(app, ui, Icon::SpaceV, "align.space_v");
});
// Match Size (#566): to the largest selected object, or with To stage to the stage.
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing.x = 2.0;
button(app, ui, Icon::MatchWidth, "align.match_width");
button(app, ui, Icon::MatchHeight, "align.match_height");
button(app, ui, Icon::MatchSize, "align.match_size");
ui.add_space(12.0);
crate::theme::checkbox(ui, &mut app.align_to_stage, text(Type::Body, tr!("To stage"))).on_hover_text(tr!("Align to the stage instead of the selection's bounds (a single shape always aligns to the stage)"));
});
+1 -1
View File
@@ -970,7 +970,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
}
});
ui.menu_button(tr!("Align"), |ui| {
for id in ["align.left", "align.hcenter", "align.right", "align.top", "align.vcenter", "align.bottom", "align.distribute_h", "align.distribute_v"] {
for id in ["align.left", "align.hcenter", "align.right", "align.top", "align.vcenter", "align.bottom", "align.distribute_h", "align.distribute_v", "align.space_h", "align.space_v", "align.match_width", "align.match_height", "align.match_size"] {
crate::menus::cmd_item(app, ui, id);
}
});