Make layer-border snapping independently disable moving border anchors
This commit is contained in:
parent
e7caaf806e
commit
6594de9bb4
|
|
@ -548,7 +548,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "canvas-pilot"
|
name = "canvas-pilot"
|
||||||
version = "0.9.33"
|
version = "0.9.34"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"craft-dwg",
|
"craft-dwg",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ default-members = ["crates/canvas-pilot"]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.9.33"
|
version = "0.9.34"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/canvas-pilot"
|
repository = "https://proxy.dandaedre.com/gitea/idle-org/canvas-pilot"
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "Snap movement & resizing",
|
"ui.snap-movement-resizing": "Snap movement & resizing",
|
||||||
"ui.pixel-edges": "Pixel edges",
|
"ui.pixel-edges": "Pixel edges",
|
||||||
"ui.screen-edges-center-quarters": "Screen edges, center & quarters",
|
"ui.screen-edges-center-quarters": "Screen edges, center & quarters",
|
||||||
"ui.visible-layer-edges": "Visible layer edges",
|
"ui.visible-layer-edges": "Layer borders",
|
||||||
"ui.outline-only-layers-this-project": "Outline-only layers (this project)",
|
"ui.outline-only-layers-this-project": "Outline-only layers (this project)",
|
||||||
"ui.show-toolbar-icon-names": "Show toolbar icon names",
|
"ui.show-toolbar-icon-names": "Show toolbar icon names",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "Show source patterns on other layers while cropping",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "Show source patterns on other layers while cropping",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "Algluiĝo dum movo kaj regrandigo",
|
"ui.snap-movement-resizing": "Algluiĝo dum movo kaj regrandigo",
|
||||||
"ui.pixel-edges": "Bilderaj randoj",
|
"ui.pixel-edges": "Bilderaj randoj",
|
||||||
"ui.screen-edges-center-quarters": "Ekranaj randoj, centro kaj kvaronoj",
|
"ui.screen-edges-center-quarters": "Ekranaj randoj, centro kaj kvaronoj",
|
||||||
"ui.visible-layer-edges": "Randoj de videblaj tavoloj",
|
"ui.visible-layer-edges": "Tavolaj randoj",
|
||||||
"ui.outline-only-layers-this-project": "Nur konturoj de tavoloj (ĉi tiu projekto)",
|
"ui.outline-only-layers-this-project": "Nur konturoj de tavoloj (ĉi tiu projekto)",
|
||||||
"ui.show-toolbar-icon-names": "Montri nomojn de ilobretaj piktogramoj",
|
"ui.show-toolbar-icon-names": "Montri nomojn de ilobretaj piktogramoj",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "Montri fontajn ŝablonojn sur aliaj tavoloj dum tondado",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "Montri fontajn ŝablonojn sur aliaj tavoloj dum tondado",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "Ajustar movimiento y tamaño",
|
"ui.snap-movement-resizing": "Ajustar movimiento y tamaño",
|
||||||
"ui.pixel-edges": "Bordes de píxeles",
|
"ui.pixel-edges": "Bordes de píxeles",
|
||||||
"ui.screen-edges-center-quarters": "Bordes, centro y cuartos de pantalla",
|
"ui.screen-edges-center-quarters": "Bordes, centro y cuartos de pantalla",
|
||||||
"ui.visible-layer-edges": "Bordes de capas visibles",
|
"ui.visible-layer-edges": "Bordes de capa",
|
||||||
"ui.outline-only-layers-this-project": "Solo contornos de capas (este proyecto)",
|
"ui.outline-only-layers-this-project": "Solo contornos de capas (este proyecto)",
|
||||||
"ui.show-toolbar-icon-names": "Mostrar nombres de iconos",
|
"ui.show-toolbar-icon-names": "Mostrar nombres de iconos",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "Mostrar patrones de otras capas al recortar",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "Mostrar patrones de otras capas al recortar",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "Aimantation du déplacement et du redimensionnement",
|
"ui.snap-movement-resizing": "Aimantation du déplacement et du redimensionnement",
|
||||||
"ui.pixel-edges": "Bords des pixels",
|
"ui.pixel-edges": "Bords des pixels",
|
||||||
"ui.screen-edges-center-quarters": "Bords, centre et quarts de l’écran",
|
"ui.screen-edges-center-quarters": "Bords, centre et quarts de l’écran",
|
||||||
"ui.visible-layer-edges": "Bords des calques visibles",
|
"ui.visible-layer-edges": "Bords des calques",
|
||||||
"ui.outline-only-layers-this-project": "Contours seuls (ce projet)",
|
"ui.outline-only-layers-this-project": "Contours seuls (ce projet)",
|
||||||
"ui.show-toolbar-icon-names": "Afficher les noms des outils",
|
"ui.show-toolbar-icon-names": "Afficher les noms des outils",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "Afficher les mires des autres calques pendant le recadrage",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "Afficher les mires des autres calques pendant le recadrage",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "Ἐνέργει πρόσφυσιν κινήσεως καὶ μεγέθους",
|
"ui.snap-movement-resizing": "Ἐνέργει πρόσφυσιν κινήσεως καὶ μεγέθους",
|
||||||
"ui.pixel-edges": "Ὅρια ψηφίδων",
|
"ui.pixel-edges": "Ὅρια ψηφίδων",
|
||||||
"ui.screen-edges-center-quarters": "Ὅρια, κέντρον καὶ τεταρτημόρια πετάσματος",
|
"ui.screen-edges-center-quarters": "Ὅρια, κέντρον καὶ τεταρτημόρια πετάσματος",
|
||||||
"ui.visible-layer-edges": "Ὅρια ὁρατῶν στρωμάτων",
|
"ui.visible-layer-edges": "Ἄκρα στρωμάτων",
|
||||||
"ui.outline-only-layers-this-project": "Μόνα περιγράμματα στρωμάτων (τόδε τὸ σχέδιον)",
|
"ui.outline-only-layers-this-project": "Μόνα περιγράμματα στρωμάτων (τόδε τὸ σχέδιον)",
|
||||||
"ui.show-toolbar-icon-names": "Δεῖξον τὰ ὀνόματα τῶν εἰκονιδίων",
|
"ui.show-toolbar-icon-names": "Δεῖξον τὰ ὀνόματα τῶν εἰκονιδίων",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "Ἐν τῇ ἀποτομῇ δεῖξον τὰ ὑποδείγματα πηγῶν τῶν ἄλλων στρωμάτων",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "Ἐν τῇ ἀποτομῇ δεῖξον τὰ ὑποδείγματα πηγῶν τῶν ἄλλων στρωμάτων",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "स्थान और आकार बदलते समय स्नैप करें",
|
"ui.snap-movement-resizing": "स्थान और आकार बदलते समय स्नैप करें",
|
||||||
"ui.pixel-edges": "पिक्सेल के किनारे",
|
"ui.pixel-edges": "पिक्सेल के किनारे",
|
||||||
"ui.screen-edges-center-quarters": "स्क्रीन के किनारे, केंद्र और चौथाई",
|
"ui.screen-edges-center-quarters": "स्क्रीन के किनारे, केंद्र और चौथाई",
|
||||||
"ui.visible-layer-edges": "दृश्यमान परतों के किनारे",
|
"ui.visible-layer-edges": "लेयर की सीमाएँ",
|
||||||
"ui.outline-only-layers-this-project": "केवल परतों की रूपरेखा (इस परियोजना में)",
|
"ui.outline-only-layers-this-project": "केवल परतों की रूपरेखा (इस परियोजना में)",
|
||||||
"ui.show-toolbar-icon-names": "टूलबार आइकन के नाम दिखाएँ",
|
"ui.show-toolbar-icon-names": "टूलबार आइकन के नाम दिखाएँ",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "क्रॉप करते समय अन्य परतों पर स्रोत पैटर्न दिखाएँ",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "क्रॉप करते समय अन्य परतों पर स्रोत पैटर्न दिखाएँ",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "移動とサイズ変更をスナップ",
|
"ui.snap-movement-resizing": "移動とサイズ変更をスナップ",
|
||||||
"ui.pixel-edges": "ピクセル境界",
|
"ui.pixel-edges": "ピクセル境界",
|
||||||
"ui.screen-edges-center-quarters": "画面の端、中央、四分点",
|
"ui.screen-edges-center-quarters": "画面の端、中央、四分点",
|
||||||
"ui.visible-layer-edges": "表示レイヤーの端",
|
"ui.visible-layer-edges": "レイヤーの境界",
|
||||||
"ui.outline-only-layers-this-project": "レイヤーを輪郭のみ表示(このプロジェクト)",
|
"ui.outline-only-layers-this-project": "レイヤーを輪郭のみ表示(このプロジェクト)",
|
||||||
"ui.show-toolbar-icon-names": "ツールバーのアイコン名を表示",
|
"ui.show-toolbar-icon-names": "ツールバーのアイコン名を表示",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "クロップ中に他レイヤーのソースパターンを表示",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "クロップ中に他レイヤーのソースパターンを表示",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "सार्दा र आकार बदल्दा स्न्याप गर्नुहोस्",
|
"ui.snap-movement-resizing": "सार्दा र आकार बदल्दा स्न्याप गर्नुहोस्",
|
||||||
"ui.pixel-edges": "पिक्सेलका किनाराहरू",
|
"ui.pixel-edges": "पिक्सेलका किनाराहरू",
|
||||||
"ui.screen-edges-center-quarters": "स्क्रिनका किनारा, केन्द्र र चौथाइ",
|
"ui.screen-edges-center-quarters": "स्क्रिनका किनारा, केन्द्र र चौथाइ",
|
||||||
"ui.visible-layer-edges": "देखिने तहका किनाराहरू",
|
"ui.visible-layer-edges": "तहका किनाराहरू",
|
||||||
"ui.outline-only-layers-this-project": "तहको रूपरेखा मात्र (यो परियोजना)",
|
"ui.outline-only-layers-this-project": "तहको रूपरेखा मात्र (यो परियोजना)",
|
||||||
"ui.show-toolbar-icon-names": "उपकरणपट्टीका आइकन नाम देखाउनुहोस्",
|
"ui.show-toolbar-icon-names": "उपकरणपट्टीका आइकन नाम देखाउनुहोस्",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "क्रप गर्दा अन्य तहहरूमा स्रोत ढाँचा देखाउनुहोस्",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "क्रप गर्दा अन्य तहहरूमा स्रोत ढाँचा देखाउनुहोस्",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "Encaixar movimento e tamanho",
|
"ui.snap-movement-resizing": "Encaixar movimento e tamanho",
|
||||||
"ui.pixel-edges": "Limites dos píxeis",
|
"ui.pixel-edges": "Limites dos píxeis",
|
||||||
"ui.screen-edges-center-quarters": "Limites, centro e quartos do ecrã",
|
"ui.screen-edges-center-quarters": "Limites, centro e quartos do ecrã",
|
||||||
"ui.visible-layer-edges": "Limites das camadas visíveis",
|
"ui.visible-layer-edges": "Bordas das camadas",
|
||||||
"ui.outline-only-layers-this-project": "Só contornos das camadas (neste projeto)",
|
"ui.outline-only-layers-this-project": "Só contornos das camadas (neste projeto)",
|
||||||
"ui.show-toolbar-icon-names": "Mostrar nomes dos ícones",
|
"ui.show-toolbar-icon-names": "Mostrar nomes dos ícones",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "Mostrar padrões nas outras camadas durante o recorte",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "Mostrar padrões nas outras camadas durante o recorte",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "ดูดตำแหน่งเมื่อย้ายและปรับขนาด",
|
"ui.snap-movement-resizing": "ดูดตำแหน่งเมื่อย้ายและปรับขนาด",
|
||||||
"ui.pixel-edges": "ขอบพิกเซล",
|
"ui.pixel-edges": "ขอบพิกเซล",
|
||||||
"ui.screen-edges-center-quarters": "ขอบ กึ่งกลาง และหนึ่งในสี่ของหน้าจอ",
|
"ui.screen-edges-center-quarters": "ขอบ กึ่งกลาง และหนึ่งในสี่ของหน้าจอ",
|
||||||
"ui.visible-layer-edges": "ขอบเลเยอร์ที่มองเห็น",
|
"ui.visible-layer-edges": "ขอบเลเยอร์",
|
||||||
"ui.outline-only-layers-this-project": "แสดงเฉพาะเส้นขอบเลเยอร์ (โครงการนี้)",
|
"ui.outline-only-layers-this-project": "แสดงเฉพาะเส้นขอบเลเยอร์ (โครงการนี้)",
|
||||||
"ui.show-toolbar-icon-names": "แสดงชื่อไอคอนแถบเครื่องมือ",
|
"ui.show-toolbar-icon-names": "แสดงชื่อไอคอนแถบเครื่องมือ",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "แสดงลวดลายต้นทางบนเลเยอร์อื่นขณะครอบตัด",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "แสดงลวดลายต้นทางบนเลเยอร์อื่นขณะครอบตัด",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "o awen e tawa e suli lon linja",
|
"ui.snap-movement-resizing": "o awen e tawa e suli lon linja",
|
||||||
"ui.pixel-edges": "poka pi poki sitelen",
|
"ui.pixel-edges": "poka pi poki sitelen",
|
||||||
"ui.screen-edges-center-quarters": "poka supa en insa en kipisi tu tu",
|
"ui.screen-edges-center-quarters": "poka supa en insa en kipisi tu tu",
|
||||||
"ui.visible-layer-edges": "poka pi lipu lukin",
|
"ui.visible-layer-edges": "poka pi sitelen supa",
|
||||||
"ui.outline-only-layers-this-project": "linja lipu taso (pali ni)",
|
"ui.outline-only-layers-this-project": "linja lipu taso (pali ni)",
|
||||||
"ui.show-toolbar-icon-names": "o lukin e nimi ilo",
|
"ui.show-toolbar-icon-names": "o lukin e nimi ilo",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "o lukin e sitelen tan lon lipu ante lon tenpo kipisi",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "o lukin e sitelen tan lon lipu ante lon tenpo kipisi",
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"ui.snap-movement-resizing": "移动和缩放吸附",
|
"ui.snap-movement-resizing": "移动和缩放吸附",
|
||||||
"ui.pixel-edges": "像素边缘",
|
"ui.pixel-edges": "像素边缘",
|
||||||
"ui.screen-edges-center-quarters": "屏幕边缘、中心和四分点",
|
"ui.screen-edges-center-quarters": "屏幕边缘、中心和四分点",
|
||||||
"ui.visible-layer-edges": "可见图层边缘",
|
"ui.visible-layer-edges": "图层边框",
|
||||||
"ui.outline-only-layers-this-project": "仅显示图层轮廓(此项目)",
|
"ui.outline-only-layers-this-project": "仅显示图层轮廓(此项目)",
|
||||||
"ui.show-toolbar-icon-names": "显示工具栏图标名称",
|
"ui.show-toolbar-icon-names": "显示工具栏图标名称",
|
||||||
"ui.show-source-patterns-on-other-layers-while-cropping": "裁剪时显示其他图层的源图案",
|
"ui.show-source-patterns-on-other-layers-while-cropping": "裁剪时显示其他图层的源图案",
|
||||||
|
|
|
||||||
|
|
@ -6069,7 +6069,7 @@ mod tests {
|
||||||
let mut app = Editor::default();
|
let mut app = Editor::default();
|
||||||
app.snapping.enabled = enabled;
|
app.snapping.enabled = enabled;
|
||||||
app.snapping.pixels = false;
|
app.snapping.pixels = false;
|
||||||
app.snapping.layer_edges = false;
|
app.snapping.layer_edges = true;
|
||||||
let before = app.layout.layers().clone();
|
let before = app.layout.layers().clone();
|
||||||
let saved = app.snapping;
|
let saved = app.snapping;
|
||||||
let point = if resize {
|
let point = if resize {
|
||||||
|
|
@ -6166,7 +6166,7 @@ mod tests {
|
||||||
for label in [
|
for label in [
|
||||||
"Pixel edges",
|
"Pixel edges",
|
||||||
"Screen edges, center & quarters",
|
"Screen edges, center & quarters",
|
||||||
"Visible layer edges",
|
"Layer borders",
|
||||||
] {
|
] {
|
||||||
click_text(&mut app, &ctx, label);
|
click_text(&mut app, &ctx, label);
|
||||||
}
|
}
|
||||||
|
|
@ -8583,7 +8583,7 @@ mod tests {
|
||||||
};
|
};
|
||||||
app.snapping.enabled = true;
|
app.snapping.enabled = true;
|
||||||
app.snapping.pixels = false;
|
app.snapping.pixels = false;
|
||||||
app.snapping.layer_edges = false;
|
app.snapping.layer_edges = true;
|
||||||
let before = app.layout.layers().clone();
|
let before = app.layout.layers().clone();
|
||||||
let output = frame(&mut app, &ctx, vec![]);
|
let output = frame(&mut app, &ctx, vec![]);
|
||||||
let rect = layer_rects(&output)[1];
|
let rect = layer_rects(&output)[1];
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,7 @@ impl Editor {
|
||||||
&mut self.snapping.layer_edges,
|
&mut self.snapping.layer_edges,
|
||||||
tr(ui.ctx(), "ui.visible-layer-edges"),
|
tr(ui.ctx(), "ui.visible-layer-edges"),
|
||||||
)
|
)
|
||||||
.on_hover_text(tr(
|
.on_hover_text("Snap moving outer borders and use other layers’ borders as targets. Independent of masks. Also controls mirrored/opposite resize contact; center and direct resize-handle snapping remain available.");
|
||||||
ui.ctx(),
|
|
||||||
"ui.includes-contact-between-mirrored-opposite-resizing-layers",
|
|
||||||
));
|
|
||||||
ui.checkbox(&mut self.snapping.mask_edges, tr(ui.ctx(), "ui.mask-edges"));
|
ui.checkbox(&mut self.snapping.mask_edges, tr(ui.ctx(), "ui.mask-edges"));
|
||||||
});
|
});
|
||||||
ui.weak(tr(
|
ui.weak(tr(
|
||||||
|
|
@ -484,10 +481,18 @@ mod tests {
|
||||||
click_label(&mut app, &ctx, "Snap movement & resizing");
|
click_label(&mut app, &ctx, "Snap movement & resizing");
|
||||||
click_label(&mut app, &ctx, "Mask edges & centers");
|
click_label(&mut app, &ctx, "Mask edges & centers");
|
||||||
assert!(app.snapping.mask_edges);
|
assert!(app.snapping.mask_edges);
|
||||||
|
click_label(&mut app, &ctx, "Layer borders");
|
||||||
|
assert!(!app.snapping.layer_edges);
|
||||||
|
assert!(app.snapping.mask_edges);
|
||||||
|
click_label(&mut app, &ctx, "Mask edges & centers");
|
||||||
|
assert!(!app.snapping.mask_edges);
|
||||||
|
assert!(!app.snapping.layer_edges);
|
||||||
|
click_label(&mut app, &ctx, "Mask edges & centers");
|
||||||
assert_eq!(*app.layout.layers(), before);
|
assert_eq!(*app.layout.layers(), before);
|
||||||
let (store, saved) = settings::Store::at(path);
|
let (store, saved) = settings::Store::at(path);
|
||||||
assert!(store.error.is_none());
|
assert!(store.error.is_none());
|
||||||
assert!(saved.snapping.mask_edges);
|
assert!(saved.snapping.mask_edges);
|
||||||
|
assert!(!saved.snapping.layer_edges);
|
||||||
assert!(saved.snapping.enabled);
|
assert!(saved.snapping.enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,8 +237,11 @@ impl Layout {
|
||||||
.mask_edges
|
.mask_edges
|
||||||
.then(|| mask_geometry(&before.formats, i, *g))
|
.then(|| mask_geometry(&before.formats, i, *g))
|
||||||
.flatten();
|
.flatten();
|
||||||
for (is_center, moving) in edge(*g, axis)
|
for (is_center, moving) in options
|
||||||
|
.layer_edges
|
||||||
|
.then_some(*g)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
.flat_map(|g| edge(g, axis))
|
||||||
.chain(mask.into_iter().flat_map(|g| edge(g, axis)))
|
.chain(mask.into_iter().flat_map(|g| edge(g, axis)))
|
||||||
.map(|v| (false, v))
|
.map(|v| (false, v))
|
||||||
.chain(std::iter::once((true, g.center()[axis])))
|
.chain(std::iter::once((true, g.center()[axis])))
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@ use canvas_pilot::{Layout, snapping::Snapping};
|
||||||
#[test]
|
#[test]
|
||||||
fn screen_snapping_recomputes_from_original_and_is_one_undo_step() {
|
fn screen_snapping_recomputes_from_original_and_is_one_undo_step() {
|
||||||
let mut layout = Layout::default();
|
let mut layout = Layout::default();
|
||||||
|
layout.set_visible(0, false);
|
||||||
let before = layout.layers().clone();
|
let before = layout.layers().clone();
|
||||||
let formats = layout.formats().clone();
|
let formats = layout.formats().clone();
|
||||||
let options = Snapping {
|
let options = Snapping {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
layer_edges: false,
|
layer_edges: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
layout.start_drag([1200.0, 200.0]);
|
layout.start_drag([1200.0, 200.0]);
|
||||||
|
|
@ -563,12 +564,13 @@ fn screen_quarters_snap_moving_edges_and_centers_and_survive_release() {
|
||||||
let options = Snapping {
|
let options = Snapping {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
pixels: false,
|
pixels: false,
|
||||||
layer_edges: false,
|
layer_edges: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
for fraction in [0.25, 0.5, 0.75] {
|
for fraction in [0.25, 0.5, 0.75] {
|
||||||
for anchor in [0.0, 0.5, 1.0] {
|
for anchor in [0.0, 0.5, 1.0] {
|
||||||
let mut layout = Layout::default();
|
let mut layout = Layout::default();
|
||||||
|
layout.set_visible(0, false);
|
||||||
let g = layout.layers()[1];
|
let g = layout.layers()[1];
|
||||||
let target = [1920.0 * fraction, 1080.0 * fraction];
|
let target = [1920.0 * fraction, 1080.0 * fraction];
|
||||||
let point = [
|
let point = [
|
||||||
|
|
@ -647,7 +649,7 @@ fn overlay_grid_snaps_moves_resizes_and_pivots_with_fractional_divisions() {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
pixels: false,
|
pixels: false,
|
||||||
screen_edges: false,
|
screen_edges: false,
|
||||||
layer_edges: false,
|
layer_edges: true,
|
||||||
grid: true,
|
grid: true,
|
||||||
show_grid: false,
|
show_grid: false,
|
||||||
grid_divisions: [7, 5],
|
grid_divisions: [7, 5],
|
||||||
|
|
@ -710,7 +712,7 @@ fn mask_options() -> Snapping {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
pixels: false,
|
pixels: false,
|
||||||
screen_edges: false,
|
screen_edges: false,
|
||||||
layer_edges: false,
|
layer_edges: true,
|
||||||
mask_edges: true,
|
mask_edges: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
|
@ -1085,3 +1087,56 @@ fn moving_mask_center_aligns_to_masks_screen_and_grid_with_rigid_groups_and_undo
|
||||||
assert_eq!(*layout.formats(), formats);
|
assert_eq!(*layout.formats(), formats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn layer_borders_and_mask_anchors_can_be_disabled_independently() {
|
||||||
|
use canvas_pilot::formats::Mask;
|
||||||
|
for borders in [false, true] {
|
||||||
|
for masks in [false, true] {
|
||||||
|
let mut layout = Layout::default();
|
||||||
|
layout.select(Some(1));
|
||||||
|
layout
|
||||||
|
.set_mask(
|
||||||
|
1,
|
||||||
|
Mask {
|
||||||
|
left: 0.25,
|
||||||
|
right: 0.1,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let g = layout.layers()[1];
|
||||||
|
let formats = layout.formats().clone();
|
||||||
|
let options = Snapping {
|
||||||
|
enabled: true,
|
||||||
|
pixels: false,
|
||||||
|
screen_edges: true,
|
||||||
|
layer_edges: borders,
|
||||||
|
mask_edges: masks,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
// Outer border near screen edge; masked edges and both centers are far away.
|
||||||
|
layout.start_drag([g.x, g.y]);
|
||||||
|
let guides = layout.drag_to_snapped([2.0, g.y + 17.0], options, 6.0);
|
||||||
|
assert_eq!(guides[0], borders.then_some(0.0));
|
||||||
|
assert_eq!(layout.layers()[1].x, if borders { 0.0 } else { 2.0 });
|
||||||
|
layout.cancel_drag();
|
||||||
|
// Mask's left edge near screen edge; outer border is far from guides.
|
||||||
|
layout.start_drag([g.x, g.y]);
|
||||||
|
let guides = layout.drag_to_snapped(
|
||||||
|
[-158.0, g.y + 17.0],
|
||||||
|
Snapping {
|
||||||
|
screen_edges: true,
|
||||||
|
layer_edges: false,
|
||||||
|
..options
|
||||||
|
},
|
||||||
|
6.0,
|
||||||
|
);
|
||||||
|
assert_eq!(guides[0], masks.then_some(0.0));
|
||||||
|
assert_eq!(layout.layers()[1].x, if masks { -160.0 } else { -158.0 });
|
||||||
|
layout.cancel_drag();
|
||||||
|
assert_eq!(layout.layers()[1], g);
|
||||||
|
assert_eq!(*layout.formats(), formats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### v0.9.34
|
||||||
|
|
||||||
|
- Renamed Visible layer edges to Layer borders and made disabling it exclude moving
|
||||||
|
outer borders as well as stationary border targets. Mask edges & centers remains
|
||||||
|
independently selectable, with both choices preserved in preferences/projects.
|
||||||
|
Center alignment and direct resize-handle snapping retain their existing behavior.
|
||||||
|
|
||||||
### v0.9.33
|
### v0.9.33
|
||||||
|
|
||||||
- Device mapping/transfer and import now use wider solid scrollbars whenever their
|
- Device mapping/transfer and import now use wider solid scrollbars whenever their
|
||||||
|
|
|
||||||
|
|
@ -154,10 +154,19 @@ Navigation tool choice survives selection changes and project loads in the curre
|
||||||
session; a new launch starts with Select. Pan/Zoom do not alter geometry, crop values
|
session; a new launch starts with Select. Pan/Zoom do not alter geometry, crop values
|
||||||
or document history. Existing project saves still preserve zoom/pan values.
|
or document history. Existing project saves still preserve zoom/pan values.
|
||||||
|
|
||||||
|
### Layer border snapping
|
||||||
|
|
||||||
|
**Layer borders** is independent of **Mask edges & centers**. Turn it off to stop
|
||||||
|
using outer layer borders as movement anchors or stationary snapping targets.
|
||||||
|
You can leave mask snapping on to position the visible masked picture, or disable
|
||||||
|
both options. Neither checkbox changes the other. Screen/grid center alignment,
|
||||||
|
pixel rounding and directly dragged resize handles retain their own behavior;
|
||||||
|
mirrored/opposite border-contact snapping follows **Layer borders**.
|
||||||
|
|
||||||
### Snap to masks
|
### Snap to masks
|
||||||
|
|
||||||
Enable **Mask edges & centers** in the snapping options to add the visible mask boundaries
|
Enable **Mask edges & centers** in the snapping options to add the visible mask boundaries
|
||||||
and their centers as targets, independently of **Visible layer edges**. Movement can align either
|
and their centers as targets, independently of **Layer borders**. Movement can align either
|
||||||
outer layer edges or mask edges to those targets, screen guides and grid lines.
|
outer layer edges or mask edges to those targets, screen guides and grid lines.
|
||||||
The center of a moving visible masked area can align to screen interior guides,
|
The center of a moving visible masked area can align to screen interior guides,
|
||||||
overlay grid lines and other masked-area centers. Whole-layer centers can also
|
overlay grid lines and other masked-area centers. Whole-layer centers can also
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,10 @@ fixed six-logical-pixel proximity radius converted by viewport scale. It affects
|
||||||
layer movement, resize handles and pivot placement; numeric entry, nudges and crop-content gestures
|
layer movement, resize handles and pivot placement; numeric entry, nudges and crop-content gestures
|
||||||
bypass it. Resize snapping preserves anchors and proportions and shows guides only
|
bypass it. Resize snapping preserves anchors and proportions and shows guides only
|
||||||
when the resulting edge actually reaches its target.
|
when the resulting edge actually reaches its target.
|
||||||
|
`layer_edges` independently controls outer borders as movement anchors and
|
||||||
|
stationary targets, including mirrored/opposite resize contact. Disabling it does
|
||||||
|
not change `mask_edges`. Centers, pixel rounding and directly dragged resize handles
|
||||||
|
retain their existing behavior. The serialized field and default remain unchanged.
|
||||||
`mask_edges` adds the nonempty intersection of mask reveal, layer aperture and
|
`mask_edges` adds the nonempty intersection of mask reveal, layer aperture and
|
||||||
fitted picture as edge and center targets. Hidden layers are skipped, locked layers included.
|
fitted picture as edge and center targets. Hidden layers are skipped, locked layers included.
|
||||||
Movement also adds selected mask edges and centers as anchors; resize handles remain on the
|
Movement also adds selected mask edges and centers as anchors; resize handles remain on the
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue