Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Freehand Tool Options: Accurate/Smooth ends on the Fidelity slider, Spanish rows (review of #390)

bflatastic505f3bd7ae46
diff --git a/ROADMAP.md b/ROADMAP.md
index a214ce38c..cc9972d54 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -191,7 +191,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale)
| Area | Weight | Done | Missing (main items) | One agent (h) |
|---|---:|---:|---|---:|
| Selection, transform & align tools | 6 | 85% | Free Transform/Scale/Reflect along a rotated box, Start Global Edit, transform nuances (the rotated persistent bounding box is done) | 4–6 |
-| Drawing tools | 7 | 85% | Shaper Groups (merge/punch overlapping shapes), pencil and the remaining pen modifier nuances, Touch Type, Live Corners on plain paths and polygons (and Relative rounding) | 10–15 |
+| Drawing tools | 7 | 85% | Shaper Groups (merge/punch overlapping shapes), pencil and the remaining pen modifier nuances, the freehand Tool Options' Keep selected, Alt to the Smooth tool, Blob Brush Merge Only with Selection and brush angle/roundness, Touch Type, Live Corners on plain paths and polygons (and Relative rounding) | 10–15 |
| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection and options | 3–6 |
| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | freeform and mixed spot/process gradients in SVG/PDF (exported as stops or process colours), pattern fills in Expand | 2–4 |
| Strokes, brushes, width profiles | 5 | 88% | brush options depth, brush libraries (generated in code), brushes driven by pen tilt, bearing and barrel rotation (6D art pens) | 12–20 |
diff --git a/crates/ui-egui/src/dialogs/color_guide_options.rs b/crates/ui-egui/src/dialogs/color_guide_options.rs
index 9e61ec57e..faeb11e0d 100644
--- a/crates/ui-egui/src/dialogs/color_guide_options.rs
+++ b/crates/ui-egui/src/dialogs/color_guide_options.rs
@@ -41,13 +41,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
};
form::slider(ui, d, "steps", tl!("Steps:"), 1.0..=max, "", &ramp);
form::slider(ui, d, "amount", tl!("Variation:"), 0.0..=100.0, "%", &ramp);
- ui.horizontal(|ui| {
- ui.add_space(form::SLIDER_LABEL + ui.spacing().item_spacing.x);
- let (r, _) = ui.allocate_exact_size(vec2(form::SLIDER_WIDTH, 14.0), Sense::hover());
- let font = egui::FontId::proportional(11.0);
- ui.painter().text(r.left_center(), egui::Align2::LEFT_CENTER, tl!("Less"), font.clone(), t.text_dim);
- ui.painter().text(r.right_center(), egui::Align2::RIGHT_CENTER, tl!("More"), font, t.text_dim);
- });
+ form::slider_ends(ui, form::SLIDER_LABEL, (tl!("Less"), tl!("More")));
ui.add_space(10.0);
// Preview: the base colour's row of variations.
let o = options(app, d);
diff --git a/crates/ui-egui/src/dialogs/form.rs b/crates/ui-egui/src/dialogs/form.rs
index c973b4675..6bf8d75b9 100644
--- a/crates/ui-egui/src/dialogs/form.rs
+++ b/crates/ui-egui/src/dialogs/form.rs
@@ -329,6 +329,19 @@ pub(super) fn slider_w(
}
}
+/// The words at the two ends of a slider's rail (Less … More), under a slider whose label column
+/// is `label_w` wide.
+pub(super) fn slider_ends(ui: &mut egui::Ui, label_w: f32, (left, right): (&str, &str)) {
+ let t = Tokens::get(ui.ctx());
+ ui.horizontal(|ui| {
+ ui.add_space(label_w + ui.spacing().item_spacing.x);
+ let (r, _) = ui.allocate_exact_size(egui::vec2(SLIDER_WIDTH, 14.0), egui::Sense::hover());
+ let font = egui::FontId::proportional(11.0);
+ ui.painter().text(r.left_center(), egui::Align2::LEFT_CENTER, left, font.clone(), t.text_dim);
+ ui.painter().text(r.right_center(), egui::Align2::RIGHT_CENTER, right, font, t.text_dim);
+ });
+}
+
/// The field where [`preview`] keeps the parameters it last previewed.
pub(super) const PREVIEWED: &str = "__previewed";
diff --git a/crates/ui-egui/src/dialogs/freehand.rs b/crates/ui-egui/src/dialogs/freehand.rs
index 3f8628b8b..8a6fd1889 100644
--- a/crates/ui-egui/src/dialogs/freehand.rs
+++ b/crates/ui-egui/src/dialogs/freehand.rs
@@ -80,6 +80,7 @@ fn fidelity(ui: &mut egui::Ui, d: &mut Dialog) {
if let Some(n) = new.filter(|n| *n != v) {
d.fields.insert("fidelity".into(), json!(n));
}
+ form::slider_ends(ui, label_w, (tl!("Accurate"), tl!("Smooth")));
ui.label(
egui::RichText::new(tl!("A lower value follows the stroke closely; a higher one gives fewer points and smoother curves."))
.size(11.5)
@@ -136,7 +137,15 @@ mod tests {
// Pencil: Fidelity, fill, the two tolerances; no Size.
app.run("tool.options", json!({"tool": "pencil"})).unwrap();
let text = painted(&mut app);
- for label in ["Pencil Tool Options", "Fidelity:", "Fill new strokes", "Close paths when ends are within:", "Edit selected paths within:"] {
+ for label in [
+ "Pencil Tool Options",
+ "Fidelity:",
+ "Accurate",
+ "Smooth",
+ "Fill new strokes",
+ "Close paths when ends are within:",
+ "Edit selected paths within:",
+ ] {
assert!(text.contains(label), "{label} in {text}");
}
assert!(!text.contains("Size:"), "{text}");
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 7e66f6f0f..1bb213d42 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -36,11 +36,13 @@
[Default] is protected: New… starts an editable copy. [Predeterminado] está protegido: Nuevo… crea una copia editable.
[Unnamed] [Sin nombre]
A File… Un archivo…
+ A lower value follows the stroke closely; a higher one gives fewer points and smoother curves. Un valor menor sigue el trazo de cerca; uno mayor da menos puntos y curvas más suaves.
A new preset starting from the selected one Un preajuste nuevo a partir del seleccionado
A saved copy of the selected preset Una copia guardada del preajuste seleccionado
About VectorCraft Acerca de VectorCraft
above arriba
Absolute Position Posición absoluta
+ Accurate Preciso
Abutting Contiguo
Action {n} Acción {n}
Actions Acciones
@@ -347,6 +349,7 @@
Close All Cerrar todo
Close Library Cerrar biblioteca
Close Path Cerrar trazado
+ Close paths when ends are within: Cerrar trazados cuando los extremos estén a menos de:
Cmd Cmd
CMYK CMYK
CMYK Color Color CMYK
@@ -726,6 +729,7 @@
Edit Pattern Editar motivo
Edit PDF Preset Editar preajuste de PDF
Edit Print Preset Editar preajuste de impresión
+ Edit selected paths within: Editar trazados seleccionados a menos de:
Edit Selection Editar selección
Edit Selection… Editar selección…
Edit Symbol Editar símbolo
@@ -892,6 +896,7 @@
Fill & Stroke Relleno y trazo
Fill (X), double-click for the Color Picker Relleno (X), doble clic para el selector de color
Fill and Stroke Relleno y trazo
+ Fill new strokes Rellenar trazos nuevos
Fill Color Color de relleno
Fill New Type Objects With Placeholder Text Rellenar nuevos objetos de texto con texto de muestra
Fill Rule Regla de relleno
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 156f0108a..94ed136c8 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -664,6 +664,7 @@
A new preset starting from the selected one 選択したプリセットをもとにした新しいプリセット
A saved copy of the selected preset 選択したプリセットの保存済みの複製
Absolute Position 絶対位置
+ Accurate 精細
Abutting 隣接
Activate Document ドキュメントをアクティブにする
Active Perspective Plane アクティブな遠近面
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 59e4b424e..4b24fd407 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -104,6 +104,7 @@
A saved copy of the selected preset Uma cópia salva do predefinido selecionado
About VectorCraft Sobre o VectorCraft
Absolute Position Posição Absoluta
+ Accurate Preciso
Abutting Contíguo
Actions Ações
Activate Document Ativar Documento
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 2335e05ee..97d351229 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -46,6 +46,7 @@
About VectorCraft 关于 VectorCraft
above 以上
Absolute Position 绝对位置
+ Accurate 精确
Abutting 相邻
Action {n} 动作 {n}
Actions 动作
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 6ad02831a..cbe191d28 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -54,6 +54,7 @@
About VectorCraft 關於 VectorCraft
above 以上
Absolute Position 絕對位置
+ Accurate 精確
Abutting 相鄰
Action {n} 動作 {n}
Actions 動作