Merge pull request #7736 from dotCooCoo/feat/pattern-move-tile-with-art

Pattern Options: Move Tile with Art moves the tile with the pattern's art
This commit is contained in:
BFlat authored and GitHub committed 2026-11-15 11:36:50 +07:00
commit c7ed93dc31
35 files changed
+249 -10

No files matched your search

+5
View File
@@ -173,6 +173,10 @@ pub struct PatternDef {
/// Size Tile to Art: the tile is the art bounds grown by the spacing.
#[serde(default)]
pub size_tile_to_art: bool,
/// Move Tile with Art: in pattern editing mode, a move of all of the tile art moves the tile by
/// the same offset.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub move_tile_with_art: bool,
#[serde(default)]
pub h_spacing: f64,
#[serde(default)]
@@ -202,6 +206,7 @@ impl PatternDef {
art,
overlap: Overlap::default(),
size_tile_to_art: false,
move_tile_with_art: false,
h_spacing: 0.0,
v_spacing: 0.0,
copies: 5,
@@ -158,6 +158,9 @@ fn apply_transform_moving_guides(
}
None => ids.clone(),
};
// Pattern editing with Move Tile with Art: the tile art's bounds before a move.
let moves_only = c[0] == 1.0 && c[1] == 0.0 && c[2] == 0.0 && c[3] == 1.0;
let tile_art = if objects && !copy && moves_only { crate::cmd::patterncmds::tile_art_bounds(d) } else { None };
// Transforms don't move nodes in the tree, so reuse the paths found for the no-copy
// case; copies and a settled typing session need paths from the edited document.
let paths = if reindex { d.index_paths(targets.iter().copied()) } else { paths };
@@ -172,6 +175,10 @@ fn apply_transform_moving_guides(
for id in &targets {
super::pixelgrid::keep_compound_aligned(d, *id, sc);
}
// Moving all of the tile art moves the tile as far.
if let Some(before) = tile_art {
crate::cmd::patterncmds::move_tile_with_art(d, &targets, before);
}
}
if with_guides && (delta.x != 0.0 || delta.y != 0.0) {
for i in sel.guides.clone() {
+64 -8
View File
@@ -78,7 +78,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Pattern Options",
["Window", "Pattern Options"],
None,
"{name? (default: the pattern being edited), newName? (trimmed; blank: the name is kept), tileType?, brickOffset?, width?, height?, hSpacing?, vSpacing?, sizeTileToArt?: bool, overlap?: {h: left|right, v: top|bottom}, copies?: 3|5|7|9, dimCopies?: %, showTileEdge?: bool, showSwatchBounds?: bool (outline the part of the tiling the swatch repeats, dashed)}",
"{name? (default: the pattern being edited), newName? (trimmed; blank: the name is kept), tileType?, brickOffset?, width?, height?, hSpacing?, vSpacing?, sizeTileToArt?: bool, moveTileWithArt?: bool (in pattern editing mode, a move of all of the tile art moves the tile with it; off for a new pattern), overlap?: {h: left|right, v: top|bottom}, copies?: 3|5|7|9, dimCopies?: %, showTileEdge?: bool, showSwatchBounds?: bool (outline the part of the tiling the swatch repeats, dashed)}",
has_doc,
pattern_options
),
@@ -530,7 +530,7 @@ fn pattern_options(s: &mut Session, p: &Value) -> Result<Value> {
let cur = s.doc()?.doc.pattern(&name).cloned().ok_or_else(|| bad(C, format!("no pattern `{name}`")))?;
let tt = tile_type_param(p, C, cur.tile_type)?;
check_numbers(p, &["width", "height", "hSpacing", "vSpacing", "copies", "dimCopies"], C)?;
check_switches(p, &["sizeTileToArt", "showTileEdge", "showSwatchBounds"], C)?;
check_switches(p, &["sizeTileToArt", "moveTileWithArt", "showTileEdge", "showSwatchBounds"], C)?;
let num = |k: &str| p.get(k).and_then(Value::as_f64);
for k in ["width", "height"] {
if num(k).is_some_and(|v| !(v.is_finite() && v > 0.0)) {
@@ -560,11 +560,11 @@ fn pattern_options(s: &mut Session, p: &Value) -> Result<Value> {
};
let edit_layer = editing(s).filter(|e| e.pattern == name).map(|e| e.layer);
let out_name = new_name.clone().unwrap_or(name.clone());
s.edit("Pattern Options", |d, _| {
// While editing, the tile art is the edit layer's.
let live_art: Option<Vec<Arc<Node>>> =
edit_layer.and_then(|l| d.node(l)).and_then(|l| l.children()).map(|ch| ch.iter().filter(|c| !c.is_ruler_guide()).cloned().collect());
let def = d.pattern_mut(&name).ok_or_else(|| EngineError::Other("pattern missing".into()))?;
// While editing, the tile art is the edit layer's.
let live_art = |d: &Document| -> Option<Vec<Arc<Node>>> {
edit_layer.and_then(|l| d.node(l)).and_then(|l| l.children()).map(|ch| ch.iter().filter(|c| !c.is_ruler_guide()).cloned().collect())
};
let apply = |def: &mut PatternDef, live_art: Option<Vec<Arc<Node>>>| {
def.tile_type = tt;
def.overlap = overlap;
if let Some(v) = num("hSpacing") {
@@ -576,6 +576,9 @@ fn pattern_options(s: &mut Session, p: &Value) -> Result<Value> {
if let Some(v) = p.get("sizeTileToArt").and_then(Value::as_bool) {
def.size_tile_to_art = v;
}
if let Some(v) = p.get("moveTileWithArt").and_then(Value::as_bool) {
def.move_tile_with_art = v;
}
if let Some(v) = num("copies") {
def.copies = (v as u32).clamp(1, 15) | 1;
}
@@ -590,13 +593,24 @@ fn pattern_options(s: &mut Session, p: &Value) -> Result<Value> {
}
if def.size_tile_to_art {
let saved = std::mem::take(&mut def.art);
def.art = live_art.clone().unwrap_or_else(|| saved.clone());
def.art = live_art.unwrap_or_else(|| saved.clone());
def.fit_tile_to_art();
def.art = saved;
} else if num("width").is_some() || num("height").is_some() {
let c = def.tile.center();
def.tile = Rect::from_center_size(c, (num("width").unwrap_or(def.tile.width()), num("height").unwrap_or(def.tile.height())));
}
};
// Options that change nothing leave the document and its undo history as they are.
let mut next = cur.clone();
apply(&mut next, live_art(&s.doc()?.doc));
if next == cur && new_name.is_none() {
return Ok(json!({ "name": out_name }));
}
s.edit("Pattern Options", |d, _| {
let live = live_art(d);
let def = d.pattern_mut(&name).ok_or_else(|| EngineError::Other("pattern missing".into()))?;
apply(def, live);
if let Some(nn) = &new_name {
def.name = nn.clone();
rename_pattern_uses(d, &name, nn);
@@ -609,6 +623,47 @@ fn pattern_options(s: &mut Session, p: &Value) -> Result<Value> {
Ok(json!({ "name": out_name }))
}
/// The tile art's objects (the editing layer's, ruler guides aside) while `d` edits a pattern that
/// has Move Tile with Art on, with the pattern's name.
fn moving_tile_art(d: &Document) -> Option<(String, Vec<Arc<Node>>)> {
let pe = d.pattern_edit.as_ref()?;
if !d.pattern(&pe.pattern).is_some_and(|p| p.move_tile_with_art) {
return None;
}
let art = d.node(pe.layer)?.children()?.iter().filter(|c| !c.is_ruler_guide()).cloned().collect();
Some((pe.pattern.clone(), art))
}
/// Before a move: the bounds of the tile art for [`move_tile_with_art`], `None` unless `d` edits a
/// pattern with Move Tile with Art on.
pub(crate) fn tile_art_bounds(d: &Document) -> Option<Rect> {
moving_tile_art(d).and_then(|(_, art)| vectorcraft_doc::live::nodes_bounds(&art))
}
/// Move Tile with Art: after a move of `moved` that takes every object of the tile art (a group
/// counting when all of its objects moved), the tile moves by as much as the art did, measured from
/// its bounds `before` the move (objects aligned to the pixel grid snap back to it). A move of only
/// some of the art leaves the tile where it is.
pub(crate) fn move_tile_with_art(d: &mut Document, moved: &[NodeId], before: Rect) {
let Some((name, art)) = moving_tile_art(d) else { return };
let moved: std::collections::HashSet<NodeId> = moved.iter().copied().collect();
// An object moves whole when it moved, or when every object in it did (a group whose members
// were selected and moved one by one).
fn whole(n: &Node, moved: &std::collections::HashSet<NodeId>) -> bool {
moved.contains(&n.id) || n.children().is_some_and(|ch| !ch.is_empty() && ch.iter().all(|c| whole(c, moved)))
}
if art.is_empty() || !art.iter().all(|c| whole(c, &moved)) {
return;
}
let Some(after) = vectorcraft_doc::live::nodes_bounds(&art) else { return };
let by = after.origin() - before.origin();
if (by.x != 0.0 || by.y != 0.0)
&& let Some(def) = d.pattern_mut(&name)
{
def.tile = def.tile + by;
}
}
/// Side `side` of the `overlap` object `o` gives `cmd`: true for the second of `names`, false for the
/// first, `current` when `o` leaves it out or gives null. Any other value is an error.
fn overlap_side(o: &Value, side: &str, names: [&str; 2], current: bool, cmd: &str) -> Result<bool> {
@@ -680,6 +735,7 @@ fn pattern_list(s: &mut Session, _: &Value) -> Result<Value> {
"hSpacing": p.h_spacing,
"vSpacing": p.v_spacing,
"sizeTileToArt": p.size_tile_to_art,
"moveTileWithArt": p.move_tile_with_art,
"overlap": {"h": if p.overlap.right_in_front { "right" } else { "left" }, "v": if p.overlap.bottom_in_front { "bottom" } else { "top" }},
"copies": p.copies,
"dimCopies": p.dim_copies,
+106
View File
@@ -492,6 +492,111 @@ fn options_set_tile_type_spacing_and_overlap() {
assert!(s.execute("pattern.options", &json!({"name": "Dots", "width": -1})).is_err());
}
/// Move Tile with Art: in pattern editing mode, a move of all of the tile art moves the tile by the
/// same offset, through `object.move`, `object.nudge` and `object.transform`. With the option off
/// (a new pattern's default), a move of part of the art, a rotation or a copy, the tile stays.
/// Undo puts the tile back, and Done keeps the moved tile.
#[test]
fn move_tile_with_art_moves_the_tile_when_all_of_the_art_moves() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let b = rect(&mut s, 12.0, 0.0, 6.0, 6.0);
sel(&mut s, &[a, b]);
s.execute("object.pattern.make", &json!({"name": "P"})).unwrap();
let tile = |s: &Session| doc(s).pattern("P").unwrap().tile;
let start = tile(&s);
let art: Vec<NodeId> = s.doc().unwrap().selection.objects.to_vec();
assert_eq!(art.len(), 2);
assert!(!doc(&s).pattern("P").unwrap().move_tile_with_art, "off for a new pattern");
s.execute("object.move", &json!({"dx": 5, "dy": 0})).unwrap();
assert_eq!(tile(&s), start, "with the option off the tile stays");
s.execute("object.move", &json!({"dx": -5, "dy": 0})).unwrap();
s.execute("pattern.options", &json!({"moveTileWithArt": true})).unwrap();
assert_eq!(s.execute("pattern.list", &json!({})).unwrap()["patterns"][0]["moveTileWithArt"], true);
s.execute("object.move", &json!({"dx": 3, "dy": 4})).unwrap();
assert_eq!(tile(&s), start + vectorcraft_geom::Vec2::new(3.0, 4.0));
s.execute("object.transform", &json!({"matrix": [1, 0, 0, 1, -1, 2]})).unwrap();
assert_eq!(tile(&s), start + vectorcraft_geom::Vec2::new(2.0, 6.0));
let k = s.prefs.keyboard_increment;
s.execute("object.nudge", &json!({"dx": 1, "dy": 0})).unwrap();
assert_eq!(tile(&s), start + vectorcraft_geom::Vec2::new(2.0 + k, 6.0));
s.execute("edit.undo", &json!({})).unwrap();
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(tile(&s), start + vectorcraft_geom::Vec2::new(3.0, 4.0), "undo puts the tile back");
let moved = tile(&s);
sel(&mut s, &art[..1]);
s.execute("object.move", &json!({"dx": 7, "dy": 0})).unwrap();
assert_eq!(tile(&s), moved, "a move of part of the art leaves the tile");
sel(&mut s, &art);
s.execute("object.rotate", &json!({"angle": 90})).unwrap();
assert_eq!(tile(&s), moved, "a rotation leaves the tile");
s.execute("object.move", &json!({"dx": 1, "dy": 1, "copy": true})).unwrap();
assert_eq!(tile(&s), moved, "a copy leaves the tile");
s.execute("object.pattern.done", &json!({})).unwrap();
assert_eq!(tile(&s), moved, "Done keeps the moved tile");
assert!(doc(&s).pattern("P").unwrap().move_tile_with_art);
}
/// Move Tile with Art counts a group in the tile art as moved when each of its members moved, one
/// by one selected.
#[test]
fn move_tile_with_art_counts_a_group_whose_members_all_moved() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let b = rect(&mut s, 12.0, 0.0, 6.0, 6.0);
sel(&mut s, &[a, b]);
s.execute("object.group", &json!({})).unwrap();
s.execute("object.pattern.make", &json!({"name": "G"})).unwrap();
s.execute("pattern.options", &json!({"moveTileWithArt": true})).unwrap();
let start = doc(&s).pattern("G").unwrap().tile;
let layer = doc(&s).pattern_edit.as_ref().unwrap().layer;
let group = doc(&s).node(layer).unwrap().children().unwrap()[0].clone();
let members: Vec<NodeId> = group.children().unwrap().iter().map(|c| c.id).collect();
assert_eq!(members.len(), 2);
sel(&mut s, &members[..1]);
s.execute("object.move", &json!({"dx": 4, "dy": 0})).unwrap();
assert_eq!(doc(&s).pattern("G").unwrap().tile, start, "one member of two");
sel(&mut s, &members);
s.execute("object.move", &json!({"dx": 0, "dy": 5})).unwrap();
assert_eq!(doc(&s).pattern("G").unwrap().tile, start + vectorcraft_geom::Vec2::new(0.0, 5.0), "every member");
}
/// Move Tile with Art moves the tile as far as the art moved: when the art is aligned to the pixel
/// grid and a move snaps it to the grid, the tile moves by the snapped distance.
#[test]
fn move_tile_with_art_follows_art_that_snaps_to_the_pixel_grid() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
sel(&mut s, &[a]);
s.execute("object.pattern.make", &json!({"name": "P"})).unwrap();
s.execute("pattern.options", &json!({"moveTileWithArt": true})).unwrap();
let art = s.doc().unwrap().selection.objects[0];
std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).node_mut(art).unwrap().extras_mut().pixel_aligned = true;
let start = doc(&s).pattern("P").unwrap().tile;
let origin = |s: &Session| doc(s).node(art).unwrap().geometric_bounds().unwrap().origin();
let before = origin(&s);
s.execute("object.move", &json!({"dx": 0.3, "dy": 0})).unwrap();
let moved = origin(&s) - before;
assert!((moved.x - 0.3).abs() > 1e-6, "the art snapped to the grid: {moved:?}");
assert_eq!(doc(&s).pattern("P").unwrap().tile, start + moved, "the tile moved as far");
}
/// Pattern Options that change nothing record no undo step.
#[test]
fn options_that_change_nothing_record_no_undo_step() {
let mut s = session();
make_dots(&mut s);
let steps = |s: &Session| s.doc().unwrap().history.undo.len();
let before = steps(&s);
s.execute("pattern.options", &json!({"name": "Dots", "moveTileWithArt": false, "copies": 5})).unwrap();
assert_eq!(steps(&s), before);
s.execute("pattern.options", &json!({"name": "Dots", "moveTileWithArt": true})).unwrap();
assert_eq!(steps(&s), before + 1);
}
#[test]
fn options_rename_updates_swatch_and_paints() {
let mut s = session();
@@ -1625,6 +1730,7 @@ fn pattern_commands_refuse_a_param_of_the_wrong_type() {
("pattern.options", options(json!({"copies": "5"})), number("copies", json!("5"))),
("pattern.options", options(json!({"dimCopies": "50"})), number("dimCopies", json!("50"))),
("pattern.options", options(json!({"sizeTileToArt": "true"})), switch("sizeTileToArt")),
("pattern.options", options(json!({"moveTileWithArt": "yes"})), switch("moveTileWithArt")),
("pattern.options", options(json!({"showTileEdge": 1})), switch("showTileEdge")),
("pattern.options", options(json!({"showSwatchBounds": "no"})), switch("showSwatchBounds")),
("pattern.options", options(json!({"overlap": "right"})), "`overlap` must be an object, not \"right\"".into()),
+1
View File
@@ -3327,6 +3327,7 @@ digits Malayalam Малаялам
Sixth Space Шесто разстояние
Size Размер
Size Tile to Art Оразмеряване на плочката според обектите
Move Tile with Art Преместване на плочката заедно с обектите
Size/Leading Размер/междуредие
Size: Размер:
Ridges per segment: Изпъкналости на сегмент:
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -2103,6 +2103,7 @@ digits Malayalam Malajalam
Show Swatch Bounds Prikaži granice uzorka boje
Show Tile Edge Prikaži ivicu pločice
Size Tile to Art Prilagodi pločicu crtežu
Move Tile with Art Pomjeri pločicu s crtežom
Tile Type: Vrsta pločice:
Top in Front Vrh naprijed
V Spacing: Okomiti razmak:
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -4349,6 +4349,7 @@ digits Malayalam Malaiàlam
Sixth Space Espai de sisena part
Size Mida
Size Tile to Art Ajusta la mida del mosaic a l’art
Move Tile with Art Mou el mosaic amb l’art
Size/Leading Mida/Interlineat
Size: Mida:
Size: {size} Tracking: {tracking} Mida: {size} Espaiat: {tracking}
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -2134,6 +2134,7 @@ digits Malayalam Malajálamské
Show Swatch Bounds Zobrazit hranice položky vzorníku
Show Tile Edge Zobrazit okraj dlaždice
Size Tile to Art Velikost dlaždice podle kresby
Move Tile with Art Přesouvat dlaždici s kresbou
Tile Type: Typ dlaždice:
Top in Front Horní vpředu
V Spacing: Svislá mezera:
Can't render this file because it is too large.
+1
View File
@@ -2543,6 +2543,7 @@ digits Malayalam Malayalam
Show Swatch Bounds Vis farveprøvegrænser
Show Tile Edge Vis flisekant
Size Tile to Art Tilpas flise til grafik
Move Tile with Art Flyt flise med grafik
Tile Type: Flisetype:
Top in Front Toppen forrest
V Spacing: Lodret afstand:
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3389,6 +3389,7 @@ digits Malayalam Malayalam
Sixth Space Sechstelgeviert-Leerzeichen
Size Größe
Size Tile to Art Kachelgröße an Grafik anpassen
Move Tile with Art Kachel mit Grafik verschieben
Size/Leading Größe/Zeilenabstand
Size: Größe:
Ridges per segment: Zacken pro Segment:
Can't render this file because it is too large.
+1
View File
@@ -3972,6 +3972,7 @@ digits Malayalam Μαλαγιάλαμ
Toggle Line Composer Εναλλαγή σύνθεσης γραμμών
Sixth Space Διάστημα ενός έκτου
Size Tile to Art Προσαρμογή μεγέθους πλακιδίου στο σχέδιο
Move Tile with Art Μετακίνηση πλακιδίου μαζί με το σχέδιο
Size/Leading Μέγεθος/διάστιχο
Ridges per segment: Ράχες ανά τμήμα:
Size: {size} Tracking: {tracking} Μέγεθος: {size} Απόσταση χαρακτήρων: {tracking}
Can't render this file because it is too large.
+1
View File
@@ -3420,6 +3420,7 @@ digits Malayalam Malayálam
Sixth Space Sexto de espacio
Size Tamaño
Size Tile to Art Ajustar tamaño del mosaico a la ilustración
Move Tile with Art Mover mosaico con la ilustración
Size/Leading Tamaño/interlineado
Size: Tamaño:
Ridges per segment: Crestas por segmento:
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -2095,6 +2095,7 @@ digits Malayalam Malajalam
Show Swatch Bounds Näytä värimallin rajat
Show Tile Edge Näytä ruudun reuna
Size Tile to Art Sovita ruudun koko kuvitukseen
Move Tile with Art Siirrä ruutua kuvituksen mukana
Tile Type: Ruudun tyyppi:
Top in Front Ylin edessä
V Spacing: Pystyväli:
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3412,6 +3412,7 @@ digits Malayalam Malayalam
Sixth Space Espace d’un sixième
Size Taille
Size Tile to Art Ajuster le carreau à l’illustration
Move Tile with Art Déplacer le carreau avec l’illustration
Size/Leading Taille/interlignage
Size: Taille :
Ridges per segment: Crêtes par segment :
Can't render this file because it is too large.
+1
View File
@@ -3536,6 +3536,7 @@
Sixth Space છઠ્ઠી જગ્યા
Size કદ
Size Tile to Art ટાઇલનું કદ આર્ટ પ્રમાણે કરો
Move Tile with Art ટાઇલને આર્ટ સાથે ખસેડો
Size/Leading કદ/લીડિંગ
Size: કદ:
Size: {size} Tracking: {tracking} કદ: {size} ટ્રેકિંગ: {tracking}
Can't render this file because it contains an unexpected character in line 72 and column 5.
+1
View File
@@ -4696,6 +4696,7 @@ antiAlias Sharp शार्प
Sixth Space छठे हिस्से जितना स्पेस
Size आकार
Size Tile to Art आकार टाइल कला के लिए
Move Tile with Art टाइल को कला के साथ ले जाएँ
Size: साइज़:
Size: {size} Tracking: {tracking} साइज़: {size} ट्रैकिंग: {tracking}
Size/Leading साइज़/लीडिंग
Can't render this file because it is too large.
+1
View File
@@ -4069,6 +4069,7 @@ mark-style Japanese Japán
Sixth Space Hatodkvirt-szóköz
Size Méret
Size Tile to Art Csempe méretezése a grafikához
Move Tile with Art Csempe mozgatása a grafikával
Size/Leading Méret/sorköz
Size: Méret:
Size: {size} Tracking: {tracking} Méret: {size} Betűköz: {tracking}
Can't render this file because it is too large.
+1
View File
@@ -1934,6 +1934,7 @@ digits Malayalam Malayalam
Show Swatch Bounds Tampilkan batas swatch
Show Tile Edge Tampilkan tepi ubin
Size Tile to Art Sesuaikan ukuran ubin dengan karya seni
Move Tile with Art Pindahkan ubin bersama karya seni
Tile Type: Jenis ubin:
Top in Front Atas di depan
V Spacing: Jarak V:
1 # Indonesian (id) catalog. Same format as zh-hant.tsv: context <TAB> source <TAB> translation
1934
1935
1936
1937
1938
1939
1940
+1
View File
@@ -3465,6 +3465,7 @@ digits Malayalam Malayalam
Sixth Space Spazio di un sesto
Size Dimensione
Size Tile to Art Adatta tassello alla grafica
Move Tile with Art Sposta tassello con la grafica
Size/Leading Dimensione/interlinea
Size: Dimensione:
Ridges per segment: Creste per segmento:
Can't render this file because it is too large.
+1
View File
@@ -3281,6 +3281,7 @@ mark-style Japanese 日本式
Single-line Composer 1 行ずつ組む
Toggle Line Composer 行の組版方式を切り替え
Size Tile to Art タイルをアートワークのサイズに合わせる
Move Tile with Art タイルをアートワークと一緒に移動
Size/Leading サイズ/行送り
Size: サイズ:
Ridges per segment: セグメントごとの山数:
Can't render this file because it is too large.
+1
View File
@@ -1863,6 +1863,7 @@ digits Malayalam მალაიალამური
Show Swatch Bounds ფერის ნიმუშის საზღვრების ჩვენება
Show Tile Edge ფილის კიდის ჩვენება
Size Tile to Art ფილის ზომის ნახატზე მორგება
Move Tile with Art ფილის ნახატთან ერთად გადატანა
Tile Type: ფილის ტიპი:
Top in Front ზედა წინ
V Spacing: ვერტ. დაშორება:
Can't render this file because it is too large.
+1
View File
@@ -3270,6 +3270,7 @@ mark-style Japanese 일본식
Single-line Composer 한 줄 조판
Toggle Line Composer 줄 조판 방식 전환
Size Tile to Art 타일을 아트웍 크기에 맞춤
Move Tile with Art 아트웍과 함께 타일 이동
Size/Leading 크기/행간
Size: 크기:
Ridges per segment: 세그먼트당 융기 수:
Can't render this file because it is too large.
+1
View File
@@ -2452,6 +2452,7 @@ digits Malayalam Malayalam
Show Swatch Bounds Staalgrenzen weergeven
Show Tile Edge Tegelrand weergeven
Size Tile to Art Tegel aan artwork aanpassen
Move Tile with Art Tegel met artwork verplaatsen
Tile Type: Tegeltype:
Top in Front Bovenkant voorop
V Spacing: V-spatiëring:
Can't render this file because it is too large.
+1
View File
@@ -2052,6 +2052,7 @@ digits Malayalam Malajalam
Show Swatch Bounds Pokaż granice próbki
Show Tile Edge Pokaż krawędź kafelka
Size Tile to Art Dopasuj kafelek do kompozycji
Move Tile with Art Przesuwaj kafelek z kompozycją
Tile Type: Typ kafelka:
Top in Front Górny na wierzchu
V Spacing: Odstęp pion.:
Can't render this file because it is too large.
+1
View File
@@ -2892,6 +2892,7 @@ digits Malayalam Malaiala
Sixth Space Espaço de Sexto
Size Tamanho
Size Tile to Art Dimensionar Bloco para a Arte
Move Tile with Art Mover Bloco com a Arte
Size/Leading Tamanho/Entrelinhamento
Size: Tamanho:
Size: {size} Tracking: {tracking} Tamanho: {size} Rastreamento: {tracking}
Can't render this file because it is too large.
+1
View File
@@ -3452,6 +3452,7 @@ digits Malayalam Малаялам
Sixth Space Шестая шпация
Size Размер
Size Tile to Art Подогнать плитку по рисунку
Move Tile with Art Перемещать плитку вместе с рисунком
Size/Leading Размер/интерлиньяж
Size: Размер:
Ridges per segment: Гребней на сегмент:
Can't render this file because it is too large.
+1
View File
@@ -3342,6 +3342,7 @@ digits Malayalam Malayalam
Sixth Space Sjättedelsblanksteg
Size Storlek
Size Tile to Art Anpassa rutans storlek efter grafiken
Move Tile with Art Flytta rutan med grafiken
Size/Leading Storlek/radavstånd
Size: Storlek:
Ridges per segment: Åsar per segment:
Can't render this file because it is too large.
+1
View File
@@ -3218,6 +3218,7 @@ digits Malayalam Malayalam
Sixth Space Altıncı Uzay
Size Boyut
Size Tile to Art Sanata Boyut Döşeme
Move Tile with Art Döşemeyi Sanatla Taşı
Size/Leading Boyut/Satır Aralığı
Size: Boyut:
Ridges per segment: Segment başına sırtlar:
Can't render this file because it is too large.
+1
View File
@@ -3457,6 +3457,7 @@ digits Malayalam Малаялам
Sixth Space Шоста шпація
Size Розмір
Size Tile to Art Підігнати плитку за малюнком
Move Tile with Art Переміщувати плитку разом із малюнком
Size/Leading Розмір/інтерліньяж
Size: Розмір:
Ridges per segment: Гребенів на сегмент:
Can't render this file because it is too large.
+1
View File
@@ -3812,6 +3812,7 @@ mark-style Japanese Kiểu Nhật
Sixth Space Dấu cách 1/6
Size Kích thước
Size Tile to Art Kích thước ô theo đối tượng
Move Tile with Art Di chuyển ô cùng đối tượng
Size/Leading Cỡ chữ/Giãn dòng
Size: Kích thước:
Size: {size} Tracking: {tracking} Kích thước: {size} Giãn chữ: {tracking}
Can't render this file because it contains an unexpected character in line 204 and column 5.
+1
View File
@@ -3280,6 +3280,7 @@ digits Malayalam 马拉雅拉姆数字
Sixth Space 六分之一空格
Size 大小
Size Tile to Art 使拼贴适合图稿
Move Tile with Art 拼贴随图稿移动
Size/Leading 字号/行距
Size: 尺寸:
Ridges per segment: 每段起伏数:
Can't render this file because it is too large.
+1
View File
@@ -4538,6 +4538,7 @@ digits Malayalam 馬來亞拉姆數字
Sixth Space 六分之一空格
Size 大小
Size Tile to Art 拼貼符合圖稿大小
Move Tile with Art 拼貼隨圖稿移動
Size/Leading 大小/行距
Size: 大小:
Ridges per segment: 每段起伏數:
Can't render this file because it is too large.
+30 -2
View File
@@ -1,6 +1,6 @@
//! Pattern Options panel: active in pattern editing mode (Object → Pattern → Make / Edit
//! Pattern). Name, Tile Type, Brick Offset, Width/Height, Size Tile to Art with H/V spacing,
//! Overlap, Copies, Dim Copies, Show Tile Edge, Show Swatch Bounds; Save a Copy / Done / Cancel. Outside editing
//! Pattern). Name, Tile Type, Brick Offset, Width/Height, Size Tile to Art with H/V spacing, Move
//! Tile with Art, Overlap, Copies, Dim Copies, Show Tile Edge, Show Swatch Bounds; Save a Copy / Done / Cancel. Outside editing
//! mode it lists the document's patterns with an Edit button.
use egui::Ui;
@@ -94,6 +94,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
if widgets::check(ui, tl!("Size Tile to Art"), sized, true) {
set(app, &name, json!({"sizeTileToArt": !sized}));
}
if widgets::check(ui, tl!("Move Tile with Art"), def.move_tile_with_art, true) {
set(app, &name, json!({"moveTileWithArt": !def.move_tile_with_art}));
}
row(ui, tl!("H Spacing:"), |ui| {
ui.add_enabled_ui(sized, |ui| {
if let Some(v) = widgets::num_field(ui, "po-hs", Some(def.h_spacing), unit, 90.0) {
@@ -277,4 +280,29 @@ mod tests {
frame(&mut app, &ctx, vec![click(false)]);
assert!(app.session.active().unwrap().doc.pattern("Dots").unwrap().show_swatch_bounds);
}
/// The Move Tile with Art checkbox sits under Size Tile to Art and turns the option on and off.
#[test]
fn move_tile_with_art_toggles_the_pattern_option() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap();
app.run("object.pattern.make", json!({"name": "Dots"})).unwrap();
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
let on = |app: &VectorcraftApp| app.session.active().unwrap().doc.pattern("Dots").unwrap().move_tile_with_art;
let texts = frame(&mut app, &ctx, vec![]);
let find = |t: &str| texts.iter().find(|(s, _)| s == t).map(|(_, r)| *r);
let (sized, at) = (find("Size Tile to Art").expect("Size Tile to Art"), find("Move Tile with Art").expect("the checkbox"));
assert!(at.top() > sized.top(), "under Size Tile to Art");
let at = at.center();
let click = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
assert!(!on(&app));
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(at), click(true)]);
frame(&mut app, &ctx, vec![click(false)]);
assert!(on(&app));
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(at), click(true)]);
frame(&mut app, &ctx, vec![click(false)]);
assert!(!on(&app));
}
}
+8
View File
@@ -4862,6 +4862,14 @@ and `height`, so a new `hSpacing` changes the tile's width. `pattern.options` st
`object.pattern.edit` edits the pattern that fills or strokes a selected object, and `pattern.options` changes the
pattern being edited; each returns an error when there is no such pattern. `pattern.delete` requires `name`.
With `pattern.options {moveTileWithArt: true}` (Move Tile with Art), a move of all of the tile art in pattern editing
mode moves the tile by the same offset: `object.move`, `object.nudge`, `object.transform` with a translation, and drags
with the Selection tool. A move of only some of the art, a move of direct-selected anchors, a copy, a rotation and a
scale leave the tile where it is. The option is off for a new pattern and works the same with `sizeTileToArt` on. These
details are VectorCraft's own rules; the help page says only that the option moves the tile along with the art
(<https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/edit-patterns.html>).
`pattern.list` reports it as `moveTileWithArt`. A `pattern.options` call that changes nothing records no undo step.
```json
{"name":"run_command","arguments":{"command":"pattern.options","params":{"showSwatchBounds":true}}}
{"name":"run_command","arguments":{"command":"prefs.set","params":{"key":"patternTileEdgeColor","value":"#ff4f4f"}}}
+1
View File
@@ -757,6 +757,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Repeated brush names in a file:** a document or brush library file whose brushes repeat a name opens with the first brush of that name as stored and each later one numbered, as "Name 2", "Name 3" and so on, skipping names the file already has. Strokes that name the brush keep drawing the first one, and `brush.list`, `brush.options`, `brush.delete`, `brush.library` and the Brushes panel then reach each brush by its own name. This numbering is VectorCraft's own rule. Tests in `crates/brush/src/tests.rs`, `tests/brushsym.rs` and `tests/brushlib.rs` cover it.
- **Pattern names and swatch names:** `pattern.options` refuses a new name that another pattern, a swatch or a color group has. It takes a name that only the pattern's own swatches have. The reference page does not say what happens when the new name is taken; the refusal follows VectorCraft's rule that swatches and color groups share one namespace (`Document::swatch_name_taken`), which `swatch.new` and `swatch.edit` also follow. A rename gives the new name only to the pattern's swatches that had the old one; any other swatch with the old name keeps it, and art linked to that swatch stays linked. `object.pattern.make` and `object.pattern.saveCopy` number a color group's name as they number a swatch's. Tests in `tests/pattern.rs` cover each command. Public reference: [Create and edit patterns](https://web.archive.org/web/20211031180358/https://helpx.adobe.com/illustrator/using/create-edit-patterns.html) (archived copy).
- **Cancel, Delete and rename leave no paint of a missing pattern:** the help page lists Save a Copy, Done and Cancel for leaving pattern editing (https://helpx.adobe.com/illustrator/using/create-edit-patterns.html). Canceling a pattern made for the edit removes it with every swatch of it, a color group's included. Canceling a new pattern, `pattern.delete` and a `pattern.options` rename reach every paint of the pattern: art outside the editing layer, opacity mask art, type runs, symbol definitions, graph designs, the series and label paints a graph keeps for its next redraw, other patterns' tiles (a copy Save a Copy made included), graphic and character styles, brush art, and the fill, stroke and appearance new art takes. Canceling a new pattern and Delete make those paints no paint, a VectorCraft rule; a rename renames them. Canceling the edit of an existing pattern puts its definition back as it was when editing started; after a rename in Pattern Options, it also gives the pattern its old name back with its swatches and paints, unless another pattern, swatch or color group has taken that name. Undo and Redo restore new art's paints with the document. Tests in `tests/pattern.rs` cover each command.
- **Move Tile with Art:** Pattern Options has the Move Tile with Art checkbox under Size Tile to Art, and with it on, moving the tile art in pattern editing mode moves the tile with it (<https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/edit-patterns.html>). VectorCraft's own rules for what the page leaves open: the tile moves only when a move takes all of the tile art, by the same offset; rotations, scales, copies and anchor moves leave it in place; the option is off for a new pattern. `pattern.options {moveTileWithArt}` sets it and `pattern.list` reports it. Tests in `tests/pattern.rs` and `panels::pattern_options::tests` cover it.
- **A clip group in Properties:** with one clip group selected, the panel has Edit Clipping Path and Edit Contents at its top, under the Clip Group heading, which select the clipping path or the clipped art for the selection tools to transform alone, as Object › Clipping Mask does (<https://www.adobe.com/learn/illustrator/web/crop-using-masks>: with a clip group selected, the tutorial uses Edit Clipping Path at the top of the Properties panel to select the mask for editing, and uses Edit Contents to select the masked art). Edit Contents shows only when the group clips something. Not checked against the reference app: whether Properties keeps the buttons while the clipping path or the contents is selected; the Control bar has no clip-group buttons here. Evidence: `panels::properties::tests::one_clip_group_has_edit_clipping_path_and_edit_contents_at_the_top`.
- **Contextual controls in Properties:** the [Properties panel overview](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/properties-panel-overview.html) lists controls that appear for particular selections and tools; Properties has them, each running the existing command. Quick Actions has Blend Options for one selected blend, with the Blend tool or any other, as the [blending page](https://helpx.adobe.com/illustrator/using/blending-objects.html) describes (#4817) (the Blend Options dialog, OK one undo step) and Merge Live Paint when a Live Paint group is selected with more paths and nothing Live Paint refuses (`livePaint.merge`). Appearance has the stroke's Variable Width Profile list, the Control bar's, with the Width tool or when the stroke has a variable width (`stroke.set {profile}`), and beside fx the Delete icon: with one effect on the one selected object (its own or a fill's or stroke's) its name and an icon that removes it (`effect.remove`), with several an icon that opens the Appearance panel, as the overview describes. With Direct Selection and corners of one path selected, Corner and Corner Radius set the kind and radius of those corners (`object.setLiveShape`); a live rectangle's and polygon's own rows already do. Each edit is one undo step. The overview's Variable Font icon was already in Character. Not checked against the reference app: whether Merge needs two Live Paint groups (the overview speaks of several selected groups; `livePaint.merge` takes a group and paths), and where exactly each control sits in its section. Evidence: `panels::properties::tests::{blend_options_is_a_quick_action_for_one_blend_with_the_blend_tool, merge_live_paint_is_a_quick_action_for_a_live_paint_group_and_more, the_width_profile_shows_for_a_variable_width_or_the_width_tool, direct_selected_corners_show_their_kind_and_radius, one_effect_has_a_delete_icon_in_appearance}`.
- **Edit Artboards in Properties:** a Transform section comes first (#5219): the reference point the Transform panel and Control bar share, the active artboard's X and Y (of that point) and W and H with the Constrain Width and Height Proportions link, its preset and orientation, and Move and Scale Artwork with Artboard. The Artboards section follows, with the name field, Artboard Options and Fill. The active artboard's name is a field. Typing a new name and pressing Enter or clicking elsewhere renames that artboard in one undo step, as the Artboards panel's rename does (`artboard.setProps {index, name}`); pressing Escape or leaving the field empty keeps the old name. A click on the Artboard Options icon beside the field opens Artboard Options for the active artboard, as double-clicking the Artboard tool's button does (`tool.options {tool: "artboard"}`). Pointer and key tests in `panels/properties.rs` cover both. Public references: [Resize artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/resize-artboards.html) and [Create and add new artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/add-new-artboards.html).