mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-24 18:32:23 +00:00
Graphic Styles panel: address review comments and format code
This commit is contained in:
@@ -25,8 +25,8 @@ use vectorcraft_color::{BlendMode, Color, Paint};
|
||||
use vectorcraft_doc::style_libs::STYLE_LIBRARIES;
|
||||
use vectorcraft_doc::text::{CharStyle, TextObject};
|
||||
use vectorcraft_doc::{
|
||||
Appearance, AppearanceItem, DEFAULT_GRAPHIC_STYLE, Document, FillLayer, GraphicStyle, Node, NodeId, NodeKind,
|
||||
PatternDef, StrokeLayer, StyleLibrary,
|
||||
Appearance, AppearanceItem, DEFAULT_GRAPHIC_STYLE, Document, FillLayer, GraphicStyle, Node, NodeId, NodeKind, PatternDef, StrokeLayer,
|
||||
StyleLibrary,
|
||||
};
|
||||
use vectorcraft_engine::cmd::stylelib;
|
||||
use vectorcraft_engine::cmd::swatchlib::LibraryInfo;
|
||||
@@ -493,11 +493,7 @@ fn item_context_menu(app: &mut VectorcraftApp, ui: &mut Ui, name: &str, sel: &[S
|
||||
let is_multi = sel.len() > 1 && sel.contains(&name.to_string());
|
||||
let targets: Vec<String> = if is_multi {
|
||||
let doc = app.session.active().map(|st| st.doc.clone());
|
||||
if let Some(d) = &doc {
|
||||
d.graphic_styles.iter().filter(|g| sel.contains(&g.name)).map(|g| g.name.clone()).collect()
|
||||
} else {
|
||||
sel.to_vec()
|
||||
}
|
||||
if let Some(d) = &doc { d.graphic_styles.iter().filter(|g| sel.contains(&g.name)).map(|g| g.name.clone()).collect() } else { sel.to_vec() }
|
||||
} else {
|
||||
vec![name.to_string()]
|
||||
};
|
||||
@@ -536,7 +532,7 @@ fn item_context_menu(app: &mut VectorcraftApp, ui: &mut Ui, name: &str, sel: &[S
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
let is_linked = app.session.selection_graphic_style().is_some_and(|(g, _)| g.name == name);
|
||||
let is_linked = app.session.selection_graphic_style().is_some_and(|(g, linked)| linked && g.name == name);
|
||||
if menu_item(ui, tl!("Break Link to Graphic Style"), is_linked, false) {
|
||||
if let Err(e) = app.run("graphicStyle.breakLink", json!({})) {
|
||||
app.status(e);
|
||||
@@ -1827,15 +1823,12 @@ mod tests {
|
||||
app.run("graphicStyle.new", json!({"name": "Style A"})).unwrap();
|
||||
app.run("graphicStyle.new", json!({"name": "Style B"})).unwrap();
|
||||
|
||||
let mut h = egui_kittest::Harness::builder()
|
||||
.with_size(vec2(260.0, 400.0))
|
||||
.with_accessibility_check(false)
|
||||
.build_ui_state(
|
||||
|ui, app: &mut VectorcraftApp| {
|
||||
show(app, ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(260.0, 400.0)).with_accessibility_check(false).build_ui_state(
|
||||
|ui, app: &mut VectorcraftApp| {
|
||||
show(app, ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(2);
|
||||
|
||||
// Initially "Style B" was added last; "Style A" is unselected.
|
||||
@@ -1874,6 +1867,8 @@ mod tests {
|
||||
|
||||
// 3. Apply Style A to the active art and verify Break Link
|
||||
h.state_mut().run("graphicStyle.apply", json!({"name": "Style A"})).unwrap();
|
||||
// Modify appearance so style is out of sync (not linked)
|
||||
h.state_mut().run("paint.fill", json!({"color": "#ff0000"})).unwrap();
|
||||
h.run_steps(2);
|
||||
|
||||
let pos_a = h.get_by_label("Style A").rect().center();
|
||||
@@ -1883,7 +1878,24 @@ mod tests {
|
||||
h.run_steps(2);
|
||||
|
||||
let break_link = h.get_by_label(" Break Link to Graphic Style");
|
||||
assert!(!break_link.accesskit_node().is_disabled());
|
||||
assert!(break_link.accesskit_node().is_disabled(), "Break link is disabled when style is out of sync");
|
||||
|
||||
// Close menu
|
||||
h.event(egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() });
|
||||
h.run_steps(2);
|
||||
|
||||
// Reapply Style A so it is in sync
|
||||
h.state_mut().run("graphicStyle.apply", json!({"name": "Style A"})).unwrap();
|
||||
h.run_steps(2);
|
||||
|
||||
let pos_a = h.get_by_label("Style A").rect().center();
|
||||
h.event(egui::Event::PointerMoved(pos_a));
|
||||
h.event(egui::Event::PointerButton { pos: pos_a, button: egui::PointerButton::Secondary, pressed: true, modifiers: Default::default() });
|
||||
h.event(egui::Event::PointerButton { pos: pos_a, button: egui::PointerButton::Secondary, pressed: false, modifiers: Default::default() });
|
||||
h.run_steps(2);
|
||||
|
||||
let break_link = h.get_by_label(" Break Link to Graphic Style");
|
||||
assert!(!break_link.accesskit_node().is_disabled(), "Break link is enabled when style is in sync");
|
||||
break_link.click();
|
||||
h.run_steps(3);
|
||||
|
||||
@@ -1915,15 +1927,12 @@ mod tests {
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
|
||||
let app = app();
|
||||
let mut h = egui_kittest::Harness::builder()
|
||||
.with_size(vec2(260.0, 400.0))
|
||||
.with_accessibility_check(false)
|
||||
.build_ui_state(
|
||||
|ui, app: &mut VectorcraftApp| {
|
||||
show(app, ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(260.0, 400.0)).with_accessibility_check(false).build_ui_state(
|
||||
|ui, app: &mut VectorcraftApp| {
|
||||
show(app, ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(2);
|
||||
|
||||
let pos_def = h.get_by_label(DEFAULT_GRAPHIC_STYLE).rect().center();
|
||||
@@ -1950,15 +1959,12 @@ mod tests {
|
||||
app.run("graphicStyle.new", json!({"name": "Style 1"})).unwrap();
|
||||
app.run("graphicStyle.new", json!({"name": "Style 2"})).unwrap();
|
||||
|
||||
let mut h = egui_kittest::Harness::builder()
|
||||
.with_size(vec2(260.0, 400.0))
|
||||
.with_accessibility_check(false)
|
||||
.build_ui_state(
|
||||
|ui, app: &mut VectorcraftApp| {
|
||||
show(app, ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(260.0, 400.0)).with_accessibility_check(false).build_ui_state(
|
||||
|ui, app: &mut VectorcraftApp| {
|
||||
show(app, ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(2);
|
||||
|
||||
set_pstate(&h.ctx, "gs-sel", vec!["Style 1".to_string(), "Style 2".to_string()]);
|
||||
|
||||
+3
-1
@@ -71,6 +71,7 @@ M7 type: Touch Type moves a right-to-left character along its line and up from i
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-19 | minor | M14/G12: Graphic Styles panel item context menus in thumbnail and list views (Options…, Duplicate, Delete, Redefine, Break Link); regression tests in crates/ui-egui/src/panels/graphic_styles.rs; scores and estimates unchanged. |
|
||||
| 2026-11-18 | minor | M10/G5: Media Controls joins Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons and Weather Icons as a seventh built-in symbol library (Play, Pause, Stop, Skip Next, Shuffle, Repeat; original procedural vector symbols generated in code, no default 9-slice); G5 estimate decremented to 2–12 h, milestone estimates unchanged |
|
||||
| 2026-11-18 | minor | M14: PDF export writes the document language (Document Setup) as the catalog's `/Lang` (#3644). Scores and estimates unchanged. |
|
||||
| 2026-11-13 | minor | Layers: selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged. |
|
||||
@@ -190,7 +191,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule
|
||||
| M11 | Artboards & views (selected-set deletion shared by Artboards menu, trash and Properties, retaining artboard 1 when all are selected; Artboard deletion keys keep the first of an all-selected set and protect artwork; history prunes invalid indices while preserving valid multiselection (history tests and full workspace CI pass); click-to-fit objects with the Artboard tool (#1227), artboard escape routing and document setup modal handoff done; artboard panel/tool with Move Artwork for X/Y fields and Artboard Options, Trim View, middle-button pan, print tiling and the status bar's artboard navigator with synchronized Artboard tool selection done; Window › Arrange › Tile and Consolidate All Windows done; multiple windows, presentation polish) (cached canvas reprojection preserves scale during resize, rotation and DPI changes; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) (cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission; regression-tested; estimates unchanged); status-bar pointer coordinates follow the active ruler origin and General units | 🟡; Artboard Options shares existing presets and orientation controls and can fit artwork without moving it; artwork fitting includes all drawn document art across artboards and off-board; artwork bounds are cached by active document and revision, and selection uses the shared bounds cache across artboards | 15–25 |
|
||||
| M12 | Advanced color & art (CMYK/ICC, separations, Gradient Mesh, Live Paint, Image Trace, Graphs) | 🟡 Gradient Mesh, Live Paint, Image Trace (junction-returning pieces retain their positioned boundaries; a simpler contour walk with identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments; large images trace with a warning; Auto Color keeps rare distinct colours; quick presets trace at once and the Image Trace button opens the adjustment controls; Properties reopens them; tiny fitted contours retain islands and holes; Create Strokes: exact crop EDT, Guo–Hall thinning and maximal-disc graph simplification; 15 presets, the 14 documented ones each with an enhanced version; Ignore Color (manual picker and canvas eyedropper from original pixels, no canvas View change, missed pixels keep the pick armed, Preview/Undo retained; #8068), Shapes, Auto Grouping and Gradients options; measured in `image-trace-quality.md`; closed outlines retain their interior after straightening; the Flat Logo mode places edges to a fraction of a pixel, restores sharp corners, snaps lines and circles, and refuses gradients; live trace result bounds and selection highlights exclude the retained bitmap except in source-image views), Recolor Artwork, colour management (ICC, soft proofing, separations preview), Graphs (all 9 tools, Graph Data/Type, group-selected series colours persist through regenerate/save/open) done; Graph Design and Marker designs, Transpose and Switch x/y, `\|` label line breaks, the pie options, drop shadows, the legend across the top, overlapping widths, First Row/Column in Front, filled lines, kept label formatting and the Graph Data worksheet done; graph Column designs pending; Vector Halftone Preview keeps the selection box without drawing dot selection marks (#6369); Live Paint Bucket fills faces crossed in one drag (#6373) | 6–10 |
|
||||
| M13 | Automation (Actions ✅ record/playback, persisted; variables, scripting, batch) | 🟡 MCP `add_text` exposes existing vertical point, area and path type; `script.run` and File › Scripts › Other Script… run JavaScript files, and Window › Script Console shows their output; the script document model and batch work remain | 18–27 |
|
||||
| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) (status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates; sample widths cached by language/unit/DPI; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) | 🟡 Icon-strip flyouts resize on their free edges and retain sizes (#5713); interim macOS cursor delivery (#2292) uses existing artwork and host-owned AppKit cursors; headless coverage only, native menu/focus/handback and display validation pending. Dock groups collapse to their tabs by a double-click on a tab (UI.8); Preferences › General › Constrain Angle acts for the arrow keys, Shift drags and new objects (#394, 2026-10-21); numeric-field pointer selection and focus regression-tested (#1326; a release more than 1 pt from the press keeps the caret, a tap within 1 pt selects all, #6659); RPM runtime capabilities and glibc floor checked (#1275; real-distro install/start-up pending), Eyedropper cursor with precise-setting checks (#1269), Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed; other apps' text shortcut sets imported), workspaces (each keeps its layout changes until Reset <name>, UI.7), Window › Help Bar shown or hidden apart from the status bar and kept in saved workspaces, panels docked by dragging into any dock group (as tabs or a top/bottom split) or into the icon column, and closed from a dock tab's context menu (UI.6), a custom title bar on Windows/Linux with a Home button, content-sized dialogs, menus that scroll when longer than the window and macOS native menu dismissal done (M14.8), and native macOS save sheets with a Format menu (#866); titled PDF exports set `DisplayDocTitle` for viewers and accessibility checkers (#3646) and give the document language as the catalog's `/Lang` (#3644); accessibility and broader Windows/Linux packaging/QA pending; floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), with pointer and native-window regression coverage; estimates unchanged; numeric spinner arrows keep repeating while held with the mouse (#6307); Swatches item context menus tested in all five views and rendered layouts inspected; Linux full CI passed, Windows engine baseline limitations documented (G12); Window > Toolbars > Compact Tools offers optional denser main Tools spacing in one or two columns, with the existing layout still the default (#7234) | 18–28 |
|
||||
| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) (status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates; sample widths cached by language/unit/DPI; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) | 🟡 Icon-strip flyouts resize on their free edges and retain sizes (#5713); interim macOS cursor delivery (#2292) uses existing artwork and host-owned AppKit cursors; headless coverage only, native menu/focus/handback and display validation pending. Dock groups collapse to their tabs by a double-click on a tab (UI.8); Preferences › General › Constrain Angle acts for the arrow keys, Shift drags and new objects (#394, 2026-10-21); numeric-field pointer selection and focus regression-tested (#1326; a release more than 1 pt from the press keeps the caret, a tap within 1 pt selects all, #6659); RPM runtime capabilities and glibc floor checked (#1275; real-distro install/start-up pending), Eyedropper cursor with precise-setting checks (#1269), Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed; other apps' text shortcut sets imported), workspaces (each keeps its layout changes until Reset <name>, UI.7), Window › Help Bar shown or hidden apart from the status bar and kept in saved workspaces, panels docked by dragging into any dock group (as tabs or a top/bottom split) or into the icon column, and closed from a dock tab's context menu (UI.6), a custom title bar on Windows/Linux with a Home button, content-sized dialogs, menus that scroll when longer than the window and macOS native menu dismissal done (M14.8), and native macOS save sheets with a Format menu (#866); titled PDF exports set `DisplayDocTitle` for viewers and accessibility checkers (#3646) and give the document language as the catalog's `/Lang` (#3644); accessibility and broader Windows/Linux packaging/QA pending; floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), with pointer and native-window regression coverage; estimates unchanged; numeric spinner arrows keep repeating while held with the mouse (#6307); Swatches item context menus tested in all five views and rendered layouts inspected; Linux full CI passed, Windows engine baseline limitations documented (G12); Graphic Styles item context menus in thumbnail and list views with Options, Duplicate, Delete, Redefine, Break Link (#8755); Window > Toolbars > Compact Tools offers optional denser main Tools spacing in one or two columns, with the existing layout still the default (#7234) | 18–28 |
|
||||
| — | Interaction fidelity pass (every tool's modifiers, Properties panel per context, isolation, nuance; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed) | ⬜ (new ruler-guide Alt orientation implemented; existing-guide Escape cancellation regression-tested; broader pass remains) | 60–90 |
|
||||
| — | Hardening at scale (big-file corpus, fuzzing, cross-platform + browser QA) | 🟡 PngSuite integrity and bounded fetching verified (#1729); real-world corpus/manual QA remain | 50–80 |
|
||||
| M14 follow-up | Color Picker layout (#2008) | ✅ Compact controls, centered header, stacked actions, aligned fields and screen sampling; narrow windows scroll vertically | Included above |
|
||||
@@ -232,6 +233,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-19 | minor | M14/G12: Graphic Styles panel item context menus in thumbnail and list views (Options…, Duplicate, Delete, Redefine, Break Link); regression tests in crates/ui-egui/src/panels/graphic_styles.rs; scores and estimates unchanged. |
|
||||
| 2026-11-18 | minor | M10/G5: Media Controls joins Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons and Weather Icons as a seventh built-in symbol library (Play, Pause, Stop, Skip Next, Shuffle, Repeat; original procedural vector symbols generated in code, no default 9-slice); G5 estimate decremented to 2–12 h, milestone estimates unchanged |
|
||||
| 2026-11-18 | minor | M7/G4: Retype phase 1 (#4934): `type.retype` turns outlined text that exactly matches an available font back into point text. Scores and estimates unchanged |
|
||||
| 2026-11-18 | minor | M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538). Scores and estimates unchanged. |
|
||||
|
||||
+4
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user