VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Contextual Task Bar: a basic shape shows its properties in place of Lock
dotCooCoo62555c224626
diff --git a/crates/ui-egui/src/canvas/task_bar.rs b/crates/ui-egui/src/canvas/task_bar.rsindex 61c971987..cf40955ee 100644--- a/crates/ui-egui/src/canvas/task_bar.rs+++ b/crates/ui-egui/src/canvas/task_bar.rs@@ -33,6 +33,7 @@ fn picked_artboards_bounds(app: &VectorcraftApp) -> Option<Rect> {/// The Contextual Task Bar: a floating pill under the selection with the most likely next actions./// With the Artboard tool it sits under the selected artboards and offers Resize (Artboard/// Options), Duplicate, Rearrange All (with two or more artboards) and Export (Export for Screens).+/// A basic shape selected with the Selection tool shows a Shape Properties button in place of Lock./// Its handle drags it anywhere on the canvas; unpinned it keeps that offset as it follows the/// selection, pinned it stays put ([`crate::state::TaskBarPlace`]).pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {@@ -67,6 +68,17 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {&& first.as_ref().is_some_and(|f| {f.name.as_deref() == Some("Image Trace") && f.children().is_some_and(|c| c.first().is_some_and(|i| matches!(i.kind, NodeKind::Image(_))))});+ // A basic shape (a live rectangle, rounded rectangle, ellipse or polygon) selected whole with the+ // Selection tool: its properties take the place of Lock, as in the reference app+ // (<https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/contextual-task-bar-overview.html>).+ use vectorcraft_doc::LiveShape;+ let shape = first.clone().filter(|f| {+ n == 1+ && st.selection.anchors.is_empty()+ && app.session.tool_id() == "selection"+ && matches!(&f.kind, NodeKind::Path { live: Some(l), .. }+ if matches!(**l, LiveShape::Rectangle { .. } | LiveShape::Ellipse { .. } | LiveShape::Polygon { .. }))+ });let mut items: Vec<(&str, &str, &str, serde_json::Value)> = vec![]; // (label, icon, command, params)let none = || json!({});if on_artboards {@@ -228,7 +240,8 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {run = Some((*cmd, params.clone()));}}- // The selected objects' Fill, Stroke, Recolor Artwork and Lock, left out with the Artboard tool.+ // The selected objects' Fill, Stroke, Recolor Artwork and Lock (a basic shape's+ // properties instead), left out with the Artboard tool.if !on_artboards {let (r, resp) = ui.allocate_exact_size(vec2(26.0, 30.0), Sense::click());let chip = egui::Rect::from_center_size(r.center(), vec2(16.0, 16.0));@@ -251,10 +264,21 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {if colored && widgets::icon_button(ui, "palette", tl!("Recolor Artwork"), false, 30.0).clicked() {run = Some(("ui.recolorDialog", json!({})));}- // The Lock button is off in isolation mode, as Object › Lock › Selection is.- let lockable = crate::menus::enabled(app, "object.lock");- if widgets::icon_button_enabled(ui, "lock", tl!("Lock (⌘2)"), false, lockable, 30.0).clicked() {- run = Some(("object.lock", json!({})));+ if let Some(shape) = &shape+ && let NodeKind::Path { live: Some(live), .. } = &shape.kind+ {+ // The shape's properties in a popup that stays open while its fields are edited.+ let props = widgets::icon_button(ui, "shapes", tl!("Shape Properties"), false, 30.0);+ egui::Popup::menu(&props).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| {+ ui.set_min_width(250.0);+ crate::panels::transform::live_shape_rows(app, ui, shape, live, "task-bar-shape", true);+ });+ } else {+ // The Lock button is off in isolation mode, as Object › Lock › Selection is.+ let lockable = crate::menus::enabled(app, "object.lock");+ if widgets::icon_button_enabled(ui, "lock", tl!("Lock (⌘2)"), false, lockable, 30.0).clicked() {+ run = Some(("object.lock", json!({})));+ }}}let more = widgets::icon_button(ui, "ellipsis", tl!("More Options"), false, 30.0);diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rsindex ed67da712..17b05d72e 100644--- a/crates/ui-egui/src/canvas/tests.rs+++ b/crates/ui-egui/src/canvas/tests.rs@@ -6839,7 +6839,8 @@ fn the_task_bar_shows_a_stroke_chip_beside_fill() {let mut out = ctx.run_ui(raw, |ui| show(&mut app, ui));out.textures_delta.clear();let bar = task_bar_rect(&ctx).expect("the task bar shows");- // Right to left: the frame's margin, More Options, Lock, Recolor, then Stroke and Fill.+ // Right to left: the frame's margin, More Options, Shape Properties (Lock's place), Recolor,+ // then Stroke and Fill.let stroke_x = bar.right() - 8.0 - 3.0 * (30.0 + 6.0) - 13.0;let fill_x = stroke_x - 26.0 - 6.0;let blue = Color32::from_rgb(0x22, 0x44, 0xcc);@@ -6896,7 +6897,8 @@ fn the_task_bar_chips_follow_the_proxies_and_show_swatches_anywhere() {out.textures_delta.clear();out.shapes};- // Right to left: the frame's margin, More Options, Lock, Recolor, then Stroke and Fill.+ // Right to left: the frame's margin, More Options, Shape Properties (Lock's place), Recolor,+ // then Stroke and Fill.let stroke_x = |bar: egui::Rect| bar.right() - 8.0 - 3.0 * (30.0 + 6.0) - 13.0;let chip_with = |shapes: &[egui::epaint::ClippedShape], bar: egui::Rect, x: f32, color: Color32| {shapes.iter().any(|c| match &c.shape {@@ -6948,7 +6950,7 @@ fn the_task_bar_recolors_coloured_art() {frame(app, &ctx, vec![]);frame(app, &ctx, vec![]);let bar = task_bar_rect(&ctx).expect("the task bar shows");- // Right to left: the frame's margin, More Options, Lock, then Recolor.+ // Right to left: the frame's margin, More Options, Shape Properties (Lock's place), then Recolor.let at = pos2(bar.right() - 8.0 - 30.0 - 6.0 - 30.0 - 6.0 - 15.0, bar.center().y);let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };frame(app, &ctx, vec![egui::Event::PointerMoved(at)]);@@ -6975,8 +6977,11 @@ fn the_task_bar_recolors_coloured_art() {fn the_task_bar_lock_button_is_off_in_isolation_mode() {let mut app = VectorcraftApp::new(Session::new(), Default::default());app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();- let a = app.session.execute("shape.rectangle", &json!({"x": 150, "y": 130, "width": 40, "height": 40})).unwrap()["id"].clone();- let b = app.session.execute("shape.rectangle", &json!({"x": 210, "y": 130, "width": 40, "height": 40})).unwrap()["id"].clone();+ // Plain paths: a basic shape shows its properties in Lock's place.+ let square =+ |x: f64| json!({"anchors": [{"x": x, "y": 130}, {"x": x + 40.0, "y": 130}, {"x": x + 40.0, "y": 170}, {"x": x, "y": 170}], "closed": true});+ let a = app.session.execute("path.create", &square(150.0)).unwrap()["id"].clone();+ let b = app.session.execute("path.create", &square(210.0)).unwrap()["id"].clone();app.session.execute("select.set", &json!({"ids": [a.clone(), b]})).unwrap();let g = app.session.execute("object.group", &json!({})).unwrap()["id"].clone();app.select_tool("selection");diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsvindex 2048bbcc9..dabb1c8e9 100644--- a/crates/ui-egui/src/i18n/bg.tsv+++ b/crates/ui-egui/src/i18n/bg.tsv@@ -2922,6 +2922,7 @@ font-technology Variable ПроменливиShape Mode Режим на фигураShape Modes: Режими на фигури:Shape Properties: Свойства на фигурата:+ Shape Properties Свойства на фигуратаShaper Tool Инструмент „Shaper“Shapes ФигуриShear Срязванеdiff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsvindex 2ac957c9a..da8c5d134 100644--- a/crates/ui-egui/src/i18n/bs.tsv+++ b/crates/ui-egui/src/i18n/bs.tsv@@ -2014,6 +2014,7 @@ lighting Light SvjetloPolygon Properties: Svojstva mnogougla:Rectangle Properties: Svojstva pravougaonika:Shape Properties: Svojstva oblika:+ Shape Properties Svojstva oblikaSides: Stranice:Transform options Opcije transformacijeTransform Both Transformiši obojediff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsvindex ea8d62182..59984a519 100644--- a/crates/ui-egui/src/i18n/ca.tsv+++ b/crates/ui-egui/src/i18n/ca.tsv@@ -3753,6 +3753,7 @@Shape Mode Mode de formaShape Modes: Modes de forma:Shape Properties: Propietats de la forma:+ Shape Properties Propietats de la formaShape: Forma:Shaper ShaperShaper Tool Eina Shaperdiff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex 93142cadb..11d38443b 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -2041,6 +2041,7 @@ lighting Light SvětloPolygon Properties: Vlastnosti mnohoúhelníku:Rectangle Properties: Vlastnosti obdélníku:Shape Properties: Vlastnosti tvaru:+ Shape Properties Vlastnosti tvaruSides: Strany:Transform options Možnosti transformaceTransform Both Transformovat obojídiff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsvindex 160abd6bf..1203b3d36 100644--- a/crates/ui-egui/src/i18n/da.tsv+++ b/crates/ui-egui/src/i18n/da.tsv@@ -1852,6 +1852,7 @@ lighting Light LysPolygon Properties: Polygonegenskaber:Rectangle Properties: Rektangelegenskaber:Shape Properties: Figuregenskaber:+ Shape Properties FiguregenskaberSides: Sider:Transform options TransformeringsindstillingerTransform Both Transformer beggediff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex 08869d765..e832311b0 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -2957,6 +2957,7 @@ mark-style Japanese JapanischShape Mode FormmodusShape Modes: Formmodi:Shape Properties: Formeigenschaften:+ Shape Properties FormeigenschaftenShaper Tool Shaper-WerkzeugShapes FormenShear Verbiegendiff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsvindex 3d074c716..90709397a 100644--- a/crates/ui-egui/src/i18n/el.tsv+++ b/crates/ui-egui/src/i18n/el.tsv@@ -3428,6 +3428,7 @@ theme Appearance ΕμφάνισηShape Mode Λειτουργία σχήματοςShape Modes: Λειτουργίες σχημάτων:Shape Properties: Ιδιότητες σχήματος:+ Shape Properties Ιδιότητες σχήματοςShaper Tool Διαμορφωτής σχημάτων (Shaper Tool)Shear Tool Διάτμηση (Shear Tool)Shift to Color… Μετατόπιση προς χρώμα…diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex c3b905d18..f90a4b047 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -2992,6 +2992,7 @@ font-technology Variable VariablesShape Mode Modo de formaShape Modes: Modos de forma:Shape Properties: Propiedades de forma:+ Shape Properties Propiedades de formaShaper Tool Herramienta ShaperShapes FormasShear Inclinardiff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsvindex dd157932c..8c4bc1fc1 100644--- a/crates/ui-egui/src/i18n/fi.tsv+++ b/crates/ui-egui/src/i18n/fi.tsv@@ -2003,6 +2003,7 @@ lighting Light ValoPolygon Properties: Monikulmion ominaisuudet:Rectangle Properties: Suorakulmion ominaisuudet:Shape Properties: Muodon ominaisuudet:+ Shape Properties Muodon ominaisuudetSides: Sivut:Transform options MuunnosasetuksetTransform Both Muunna molemmatdiff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex 5747e2663..7db8ee535 100644--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -2989,6 +2989,7 @@ font-technology Variable VariablesShape Effects Effets de formeShape Mode Mode de formeShape Modes: Modes de forme :+ Shape Properties Propriétés de la formeShape Properties: Propriétés de la forme :Shaper Tool Outil ShaperShapes Formesdiff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsvindex 254eb37fc..0aceab5ab 100644--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@ -3602,6 +3602,7 @@ mark-style Japanese JapánShape Mode AlakzatmódShape Modes: Alakzatmódok:Shape Properties: Alakzat tulajdonságai:+ Shape Properties Alakzat tulajdonságaiShape: Alak:Shaper AlakformálóShaper Tool Alakformálódiff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsvindex 8e49c172b..95a303633 100644--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@ -1852,6 +1852,7 @@ lighting Light CahayaPolygon Properties: Properti poligon:Rectangle Properties: Properti persegi panjang:Shape Properties: Properti bentuk:+ Shape Properties Properti bentukSides: Sisi:Transform options Opsi transformasiTransform Both Transformasikan keduanyadiff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex 39addf361..a9c16d3ba 100644--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@ -3026,6 +3026,7 @@ mark-style Japanese GiapponeseShape Mode Metodo formaShape Modes: Metodi forma:Shape Properties: Proprietà forma:+ Shape Properties Proprietà formaShaper Tool Strumento SagomatoreShapes FormeShear Inclinadiff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex d9106487d..01c25917b 100644--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -2868,6 +2868,7 @@ mark-style Japanese 日本式Shape Mode シェイプモードShape Modes: シェイプモード:Shape Properties: シェイプのプロパティ:+ Shape Properties シェイプのプロパティShaper Tool Shaper ツールShapes シェイプShear シアーdiff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsvindex 9c4d6ff2f..e0e1a1095 100644--- a/crates/ui-egui/src/i18n/ka.tsv+++ b/crates/ui-egui/src/i18n/ka.tsv@@ -1754,6 +1754,7 @@ lighting Light სინათლეPolygon Properties: მრავალკუთხედის თვისებები:Rectangle Properties: მართკუთხედის თვისებები:Shape Properties: ფიგურის თვისებები:+ Shape Properties ფიგურის თვისებებიSides: გვერდები:Transform options გარდაქმნის პარამეტრებიTransform Both ორივეს გარდაქმნაdiff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex f04039cdc..45ce73252 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -2858,6 +2858,7 @@ mark-style Japanese 일본식Shape Mode 모양 모드Shape Modes: 모양 모드:Shape Properties: 모양 속성:+ Shape Properties 모양 속성Shaper Tool 셰이퍼 도구Shapes 모양Shear 기울이기diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsvindex 7fb221d3e..e4cca253f 100644--- a/crates/ui-egui/src/i18n/nl.tsv+++ b/crates/ui-egui/src/i18n/nl.tsv@@ -1866,6 +1866,7 @@ lighting Light LichtPolygon Properties: Veelhoekeigenschappen:Rectangle Properties: Rechthoekeigenschappen:Shape Properties: Vormeigenschappen:+ Shape Properties VormeigenschappenSides: Zijden:Transform options TransformatieoptiesTransform Both Beide transformerendiff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsvindex 84ac64f40..027f7198e 100644--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@ -1962,6 +1962,7 @@ lighting Light ŚwiatłoPolygon Properties: Właściwości wielokąta:Rectangle Properties: Właściwości prostokąta:Shape Properties: Właściwości kształtu:+ Shape Properties Właściwości kształtuSides: Boki:Transform options Opcje przekształcaniaTransform Both Przekształć obadiff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsvindex e48ef54bd..e9ee07994 100644--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@ -2483,6 +2483,7 @@Shape Mode Modo de FormaShape Modes: Modos de Forma:Shape Properties: Propriedades da Forma:+ Shape Properties Propriedades da FormaShaper Tool Ferramenta FormadorShapes FormasShear Cisalhardiff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex c1567d10c..dea1bee84 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -3022,6 +3022,7 @@ mark-style Japanese ЯпонскийShape Mode Режим фигурыShape Modes: Режимы фигур:Shape Properties: Свойства фигуры:+ Shape Properties Свойства фигурыShaper Tool Инструмент «Формообразование»Shapes ФигурыShear Наклонитьdiff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsvindex c75c0f6ce..fcd0427a7 100644--- a/crates/ui-egui/src/i18n/sv.tsv+++ b/crates/ui-egui/src/i18n/sv.tsv@@ -2922,6 +2922,7 @@ font-technology Variable VariablaShape Mode FormlägeShape Modes: Formlägen:Shape Properties: Formegenskaper:+ Shape Properties FormegenskaperShaper Tool FormningsverktygShapes FormerShear Skjuvadiff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsvindex 21c15371a..7a1ea3647 100644--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@ -2833,6 +2833,7 @@ shape Open AçıkShape Mode Şekil ModuShape Modes: Şekil Modları:Shape Properties: Şekil Özellikleri:+ Shape Properties Şekil ÖzellikleriShaper Tool Şekillendirici AracıShapes ŞekillerShear Kesmediff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsvindex 3117511dc..58693ddfd 100644--- a/crates/ui-egui/src/i18n/uk.tsv+++ b/crates/ui-egui/src/i18n/uk.tsv@@ -3018,6 +3018,7 @@ mark-style Japanese ЯпонськийShape Mode Режим фігуриShape Modes: Режими фігур:Shape Properties: Властивості фігури:+ Shape Properties Властивості фігуриShaper Tool Інструмент «Формоутворення»Shapes ФігуриShear Нахилитиdiff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsvindex b6d5604b3..aaa74d0e7 100644--- a/crates/ui-egui/src/i18n/vi.tsv+++ b/crates/ui-egui/src/i18n/vi.tsv@@ -3346,6 +3346,7 @@ mark-style Japanese Kiểu NhậtShape Mode Chế độ hình dạngShape Modes: Chế độ hình dạng:Shape Properties: Thuộc tính hình dạng:+ Shape Properties Thuộc tính hình dạngShape: Hình dạng:Shaper Tạo hìnhShaper Tool Công cụ Tạo hìnhdiff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex 7c50ba577..71b1fead1 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -2859,6 +2859,7 @@ font-script Japanese 汉字Shape Mode 形状模式Shape Modes: 形状模式:Shape Properties: 形状属性:+ Shape Properties 形状属性Shaper Tool Shaper 工具Shapes 形状Shear 倾斜diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 2d61281dd..a89fd28cc 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -3833,6 +3833,7 @@ font-script Japanese 漢字Shape Mode 形狀模式Shape Modes: 形狀模式:Shape Properties: 形狀內容:+ Shape Properties 形狀內容Shaper Tool Shaper 工具Shapes 形狀Shear 傾斜diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rsindex a10f5c133..c0ab7f5e9 100644--- a/crates/ui-egui/src/panels/properties.rs+++ b/crates/ui-egui/src/panels/properties.rs@@ -6,7 +6,7 @@ use vectorcraft_color::{Color, Paint};use vectorcraft_doc::{LiveCorners, LiveShape, NodeKind, Unit, WidthProfile};use vectorcraft_engine::cmd::newdoc;-use super::{corner_radius_row, first_selected, pstate, set_pstate};+use super::{first_selected, pstate, set_pstate};use crate::theme::Tokens;use crate::widgets::{self, dim_label, divider, section_header};use crate::{VectorcraftApp, icons};@@ -798,15 +798,7 @@ pub fn transform_section(app: &mut VectorcraftApp, ui: &mut Ui) {if let Some(n) = first_selected(app)&& let NodeKind::Path { live: Some(live), .. } = &n.kind{- match &**live {- vectorcraft_doc::LiveShape::Rectangle { .. } => corner_radius_row(app, ui, &n, "radius"),- vectorcraft_doc::LiveShape::Polygon { .. } => super::transform::polygon_rows(app, ui, &n, live, "props-polygon"),- vectorcraft_doc::LiveShape::Ellipse { pie, .. } => {- widgets::subheader(ui, tl!("Ellipse Properties:"));- super::transform::pie_rows(app, ui, *pie, "props-pie");- }- _ => {}- }+ super::transform::live_shape_rows(app, ui, &n, live, "props", false);}}diff --git a/crates/ui-egui/src/panels/transform.rs b/crates/ui-egui/src/panels/transform.rsindex 95f148840..df8683a01 100644--- a/crates/ui-egui/src/panels/transform.rs+++ b/crates/ui-egui/src/panels/transform.rs@@ -345,23 +345,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {&& !matches!(**live, vectorcraft_doc::LiveShape::Path { .. }){widgets::divider(ui);- match &**live {- vectorcraft_doc::LiveShape::Rectangle { .. } => {- widgets::subheader(ui, tl!("Rectangle Properties:"));- corner_radius_row(app, ui, &n, "xfp-radius");- }- vectorcraft_doc::LiveShape::Polygon { .. } => {- widgets::subheader(ui, tl!("Polygon Properties:"));- polygon_rows(app, ui, &n, live, "xfp-polygon");- }- vectorcraft_doc::LiveShape::Ellipse { pie, .. } => {- widgets::subheader(ui, tl!("Ellipse Properties:"));- pie_rows(app, ui, *pie, "xfp-pie");- }- _ => {- widgets::subheader(ui, tl!("Shape Properties:"));- widgets::dim_label(ui, tl!(n.kind_label()));- }+ if !live_shape_rows(app, ui, &n, live, "xfp", true) {+ widgets::subheader(ui, tl!("Shape Properties:"));+ widgets::dim_label(ui, tl!(n.kind_label()));}}if pstate::<bool>(ui.ctx(), "xf-hide-options") {@@ -377,6 +363,33 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {}}+/// A live rectangle's, polygon's or ellipse's properties (Transform and Properties panels, and the+/// Contextual Task Bar), their widget ids under `id`. `headed` adds the Rectangle and Polygon+/// Properties headings; an ellipse's heading always shows. Returns false, drawing nothing, for+/// other live shapes.+pub(crate) fn live_shape_rows(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, live: &LiveShape, id: &str, headed: bool) -> bool {+ match live {+ LiveShape::Rectangle { .. } => {+ if headed {+ widgets::subheader(ui, tl!("Rectangle Properties:"));+ }+ corner_radius_row(app, ui, n, &format!("{id}-radius"));+ }+ LiveShape::Polygon { .. } => {+ if headed {+ widgets::subheader(ui, tl!("Polygon Properties:"));+ }+ polygon_rows(app, ui, n, live, &format!("{id}-polygon"));+ }+ LiveShape::Ellipse { pie, .. } => {+ widgets::subheader(ui, tl!("Ellipse Properties:"));+ pie_rows(app, ui, *pie, &format!("{id}-pie"));+ }+ _ => return false,+ }+ true+}+/// An ellipse's Pie Start and End Angle (degrees, counterclockwise from 3 o'clock; 0 to 360 is the/// whole ellipse) and Invert Pie, which shows the other part of it (Transform and Properties panels).pub(crate) fn pie_rows(app: &mut VectorcraftApp, ui: &mut Ui, pie: (f64, f64), id: &str) {diff --git a/crates/ui-egui/src/tests/taskbar.rs b/crates/ui-egui/src/tests/taskbar.rsindex 27c49ac5e..2cc79e6da 100644--- a/crates/ui-egui/src/tests/taskbar.rs+++ b/crates/ui-egui/src/tests/taskbar.rs@@ -1,6 +1,7 @@//! The Contextual Task Bar's actions for each kind of selection: open paths offer Join and Edit//! Path, compound paths and clipping masks their Release, images selected with vector art Make-//! Clipping Mask, and type converts between point and area type.+//! Clipping Mask, type converts between point and area type, and a basic shape shows its+//! properties in place of Lock.use egui::{Event, PointerButton, Pos2, Rect, vec2};use serde_json::json;@@ -219,6 +220,149 @@ fn direct_selected_anchors_still_offer_remove_and_cut() {assert!(!has(&texts, "Edit Path"), "{texts:?}");}+/// Click the task bar's button left of More Options (Lock, or a basic shape's Shape Properties),+/// and return the context and what the frame after the click draws.+fn click_lock_slot(app: &mut VectorcraftApp) -> (egui::Context, Vec<(String, Rect)>) {+ let (ctx, _) = bar(app);+ let r = canvas::task_bar_rect(&ctx).expect("the task bar shows");+ // Right to left: the frame's margin, More Options, then the button.+ let p = Pos2::new(r.right() - 8.0 - 30.0 - 6.0 - 15.0, r.center().y);+ let press = |pressed| Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Default::default() };+ frame(app, &ctx, vec![Event::PointerMoved(p)]);+ frame(app, &ctx, vec![press(true)]);+ frame(app, &ctx, vec![press(false)]);+ let texts = frame(app, &ctx, vec![]);+ (ctx, texts)+}++/// Type `value` into the field showing `field` and press Enter.+fn type_into(app: &mut VectorcraftApp, ctx: &egui::Context, texts: &[(String, Rect)], field: &str, value: &str) {+ let p = at(texts, field);+ let press = |pressed| Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Default::default() };+ frame(app, ctx, vec![Event::PointerMoved(p), press(true), press(false)]);+ // Focus selected the whole field: typing replaces it.+ frame(app, ctx, vec![]);+ frame(app, ctx, vec![Event::Text(value.into())]);+ let enter = Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() };+ frame(app, ctx, vec![enter]);+ frame(app, ctx, vec![]);+}++fn live(app: &VectorcraftApp, id: u64) -> vectorcraft_doc::LiveShape {+ match kind(app, id) {+ NodeKind::Path { live: Some(l), .. } => *l,+ k => panic!("not a live shape: {k:?}"),+ }+}++fn locked(app: &VectorcraftApp, id: u64) -> bool {+ app.session.active().unwrap().doc.node(NodeId(id)).unwrap().locked+}++/// A basic shape selected with the Selection tool shows Shape Properties in place of Lock: a+/// rectangle, rounded rectangle, ellipse or polygon, each under its own heading.+#[test]+fn a_basic_shape_shows_its_properties_in_place_of_lock() {+ let mut app = app();+ let shapes = [+ (id(app.run("shape.rectangle", json!({"x": 40, "y": 40, "width": 80, "height": 60})).unwrap()), "Rectangle Properties:"),+ (id(app.run("shape.rectangle", json!({"x": 40, "y": 40, "width": 80, "height": 60, "radius": 10})).unwrap()), "Rectangle Properties:"),+ (id(app.run("shape.ellipse", json!({"x": 40, "y": 40, "width": 80, "height": 60})).unwrap()), "Ellipse Properties:"),+ (id(app.run("shape.polygon", json!({"cx": 100, "cy": 100, "radius": 40, "sides": 6})).unwrap()), "Polygon Properties:"),+ ];+ app.run("tool.select", json!({"tool": "selection"})).unwrap();+ for (shape, heading) in shapes {+ select(&mut app, &[shape]);+ let (_, texts) = bar(&mut app);+ assert!(!has(&texts, heading), "the popup starts closed: {texts:?}");+ let (_, texts) = click_lock_slot(&mut app);+ assert!(has(&texts, heading), "{heading}: {texts:?}");+ assert!(!locked(&app, shape), "the button doesn't lock the shape");+ }+}++/// The popup's fields edit the shape through `object.setLiveShape`, and Undo restores it.+#[test]+fn the_shape_properties_popup_edits_the_shape() {+ let mut app = app();+ app.run("tool.select", json!({"tool": "selection"})).unwrap();+ let corners = |app: &VectorcraftApp, id: u64| match live(app, id) {+ vectorcraft_doc::LiveShape::Rectangle { radii, .. } => radii,+ l => panic!("{l:?}"),+ };+ let rect = id(app.run("shape.rectangle", json!({"x": 40, "y": 40, "width": 80, "height": 60, "radius": 10})).unwrap());+ select(&mut app, &[rect]);+ let (ctx, texts) = click_lock_slot(&mut app);+ type_into(&mut app, &ctx, &texts, "10 pt", "20");+ assert_eq!(corners(&app, rect), [20.0; 4]);+ app.run("edit.undo", json!({})).unwrap();+ assert_eq!(corners(&app, rect), [10.0; 4]);++ let ellipse = id(app.run("shape.ellipse", json!({"x": 40, "y": 40, "width": 80, "height": 60})).unwrap());+ select(&mut app, &[ellipse]);+ let pie = |app: &VectorcraftApp| match live(app, ellipse) {+ vectorcraft_doc::LiveShape::Ellipse { pie, .. } => pie,+ l => panic!("{l:?}"),+ };+ let (ctx, texts) = click_lock_slot(&mut app);+ type_into(&mut app, &ctx, &texts, "360°", "180");+ assert_eq!(pie(&app), (0.0, 180.0));+ app.run("edit.undo", json!({})).unwrap();+ assert_eq!(pie(&app), (0.0, 360.0));++ let polygon = id(app.run("shape.polygon", json!({"cx": 100, "cy": 100, "radius": 40, "sides": 6})).unwrap());+ select(&mut app, &[polygon]);+ let sides = |app: &VectorcraftApp| match live(app, polygon) {+ vectorcraft_doc::LiveShape::Polygon { sides, .. } => sides,+ l => panic!("{l:?}"),+ };+ let (ctx, texts) = click_lock_slot(&mut app);+ type_into(&mut app, &ctx, &texts, "6", "5");+ assert_eq!(sides(&app), 5);+ app.run("edit.undo", json!({})).unwrap();+ assert_eq!(sides(&app), 6);+}++/// Every other selection keeps Lock: a plain closed path, a star (a plain path), a path with live+/// corners, a group and several objects. The Direct Selection tool keeps it for a basic shape.+#[test]+fn other_selections_keep_lock() {+ let mut app = app();+ app.run("tool.select", json!({"tool": "selection"})).unwrap();+ let closed = json!({"anchors": [{"x": 50, "y": 200}, {"x": 150, "y": 80}, {"x": 250, "y": 200}], "closed": true});+ let path = id(app.run("path.create", closed).unwrap());+ let star = id(app.run("shape.star", json!({"cx": 200, "cy": 150, "radius1": 40})).unwrap());+ let rounded = id(app.run("shape.star", json!({"cx": 300, "cy": 150, "radius1": 40})).unwrap());+ select(&mut app, &[rounded]);+ app.run("object.setLiveShape", json!({"radius": 4})).unwrap();+ assert!(matches!(live(&app, rounded), vectorcraft_doc::LiveShape::Path { .. }));+ let a = id(app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 30, "height": 30})).unwrap());+ let b = id(app.run("shape.ellipse", json!({"x": 60, "y": 20, "width": 30, "height": 30})).unwrap());+ select(&mut app, &[a, b]);+ let several = [a, b];+ let c = id(app.run("shape.rectangle", json!({"x": 20, "y": 250, "width": 30, "height": 30})).unwrap());+ let d = id(app.run("shape.rectangle", json!({"x": 60, "y": 250, "width": 30, "height": 30})).unwrap());+ select(&mut app, &[c, d]);+ let group = id(app.run("object.group", json!({})).unwrap());+ let headings = ["Rectangle Properties:", "Ellipse Properties:", "Polygon Properties:"];+ for ids in [vec![path], vec![star], vec![rounded], vec![group], several.to_vec()] {+ select(&mut app, &ids);+ let (_, texts) = click_lock_slot(&mut app);+ assert!(!headings.iter().any(|h| has(&texts, h)), "{ids:?}: {texts:?}");+ assert!(ids.iter().all(|i| locked(&app, *i)), "{ids:?} locks");+ app.run("object.unlockAll", json!({})).unwrap();+ }+ let shape = id(app.run("shape.rectangle", json!({"x": 300, "y": 40, "width": 30, "height": 30})).unwrap());+ for tool in ["directSelection", "groupSelection"] {+ app.run("tool.select", json!({ "tool": tool })).unwrap();+ select(&mut app, &[shape]);+ let (_, texts) = click_lock_slot(&mut app);+ assert!(!has(&texts, "Rectangle Properties:"), "{tool}: {texts:?}");+ assert!(locked(&app, shape), "{tool} keeps Lock");+ app.run("object.unlockAll", json!({})).unwrap();+ }+}+/// A compound path under the Direct Selection tool isn't offered Edit Path, which would only switch/// to the tool already in use; the Selection tool still offers it.#[test]diff --git a/docs/target-app-parity.md b/docs/target-app-parity.mdindex 6d97e0097..cc2b987b3 100644--- a/docs/target-app-parity.md+++ b/docs/target-app-parity.md@@ -572,6 +572,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur- With one image selected, the contextual task bar offers Image Trace, which traces the image at once with the Default preset (the Image Trace panel is left as it was), and Crop Image; with an Image Trace object it offers Expand, which keeps only the traced paths. This follows Illustrator's bar: for a selected image it includes Image Trace, Retype and Crop Image, and traced artwork can be expanded from it ([Contextual Task Bar announcement](https://community.adobe.com/announcements-651/contextual-task-bar-in-illustrator-2025-quick-actions-when-you-need-them-1546580)). Offset Path and Simplify, which don't apply to an image, aren't offered for one. Not done: Retype, which the app doesn't have.- With the Artboard tool, the contextual task bar sits under the selected artboards and offers Resize (Artboard Options for the active artboard), Duplicate (each selected artboard, in one undo step, the copies then selected), Rearrange All (with two or more artboards) and Export (Export for Screens with the selected artboards checked). This follows Illustrator's bar: while the Artboard tool is in use, it has options for resizing, duplicating and exporting artboards (the [Contextual Task Bar announcement](https://community.adobe.com/questions-652/contextual-task-bar-in-illustrator-2025-quick-actions-when-you-need-them-1546580); Rearrange and Export on the bar: [Managing Artboards in Illustrator](https://creativepro.com/managing-artboards-in-illustrator/)).- The contextual task bar offers more next steps by selection (<https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/contextual-task-bar-overview.html>): an open path Join and Edit Path (the Direct Selection tool), a closed path Edit Path, a compound path Edit Path and Release Compound Path, a clipping group Edit Clipping Path and Release Clipping Mask instead of Ungroup and Isolate, an image selected with vector art Make Clipping Mask instead of Unite, and point or area type Convert To Area Type or Convert To Point Type beside Create Outlines. Evidence: `crates/ui-egui/src/tests/taskbar.rs`.+ - With a live rectangle, rounded rectangle, ellipse or polygon selected with the Selection tool, the contextual task bar shows a Shape Properties button in place of Lock. It opens a popup with the shape's rows from the Transform panel (corner radius, pie angles, or sides, angle, corner and radius), which edit it through `object.setLiveShape`. The overview says: "For a basic shape created with tools such as the Rectangle tool and the Star tool, you get the option to adjust its properties instead of Lock Object" ([Contextual Task Bar overview](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/contextual-task-bar-overview.html)). Object › Lock and ⌘2 still lock the shape. Not done: stars, which the app draws as plain paths. Evidence: `a_basic_shape_shows_its_properties_in_place_of_lock`, `the_shape_properties_popup_edits_the_shape` and `other_selections_keep_lock` in `crates/ui-egui/src/tests/taskbar.rs`.- The contextual task bar has a Stroke chip beside the Fill chip, drawn with the paint the Stroke proxy shows (a "?" when the selected objects' strokes differ, as on the Fill chip); a click brings the Stroke proxy forward and shows the Swatches panel wherever it is docked, floating or closed, as a click on the Fill chip does for the Fill proxy. The reference app's bar has Fill and Stroke controls for changing an object's colors ([Contextual Task Bar overview](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/contextual-task-bar-overview.html)). Evidence: `the_task_bar_shows_a_stroke_chip_beside_fill` and `the_task_bar_chips_follow_the_proxies_and_show_swatches_anywhere` in `crates/ui-egui/src/canvas/tests.rs`.- With anchor points selected with Direct Selection, the contextual task bar offers Remove Anchor Points, Connect (`path.join`), Cut Path, Corner and Smooth (`path.convertAnchors` with `to` set to `corner` or `smooth`), the commands of the Control bar's anchor buttons. As in Illustrator, whose bar has items that delete the selected anchors, join selected end points, split the path at the selected anchors, and make the selected anchors corner or smooth points ([Contextual Task Bar overview](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/contextual-task-bar-overview.html)). Not done: Simplify, which the bar offers only while no anchors are selected, and the bar's Smooth item that adjusts a path's curvature, a command the app doesn't have (Object › Path › Smooth).- Tool flyouts tear off: dragging or clicking the tear-off bar on a flyout's right side (or releasing the long press over it) floats its group as a strip of tool buttons, moved by the same bar and put back in the toolbar by the × at its top (`window.floatTools`). While a group floats, the presses that would open its flyout raise the strip instead. Floating strips are kept with the preferences and in user workspaces. Not done: turning a strip vertical, docking it.