diff --git a/crates/ui-egui/src/panels/color.rs b/crates/ui-egui/src/panels/color.rs index c6a96b62d1..42b19252bd 100644 --- a/crates/ui-egui/src/panels/color.rs +++ b/crates/ui-egui/src/panels/color.rs @@ -659,7 +659,7 @@ enum SpectrumHit { fn spectrum(ui: &mut Ui, mode: Mode, size: egui::Vec2) -> Option { let t = Tokens::get(ui.ctx()); let (r, _) = ui.allocate_exact_size(size, Sense::hover()); - let resp = ui.interact(r, ui.scope_id().with("color-spectrum"), Sense::click_and_drag()); + let resp = ui.interact(r, ui.scope_id().with("color-spectrum"), Sense::click_and_drag()).on_hover_text(tl!(mode.label())); ui.painter().add(widgets::color_mesh(r, (72, 12), &|x, y| to32(&spectrum_at(mode, x, y)))); ui.painter().rect_stroke(r, 0.0, Stroke::new(1.0, t.border), StrokeKind::Outside); if let Some(p) = resp.hover_pos() { diff --git a/crates/ui-egui/tests/color_working_components.rs b/crates/ui-egui/tests/color_working_components.rs index 83b0e01267..0bf18bc721 100644 --- a/crates/ui-egui/tests/color_working_components.rs +++ b/crates/ui-egui/tests/color_working_components.rs @@ -4,12 +4,14 @@ use std::sync::{Mutex, MutexGuard}; +use egui::{Rect, vec2}; use serde_json::json; use vectorcraft_color::Color; use vectorcraft_color::cms::{self, ColorSettings, DISPLAY_P3, PROPHOTO_RGB, SRGB, WIDE_GAMUT_RGB}; use vectorcraft_engine::Session; +use vectorcraft_tools::params::color_json; use vectorcraft_ui_egui::VectorcraftApp; -use vectorcraft_ui_egui::panels::color::{Mode, components, from_components, hex_digits, parse_hex, web_safe}; +use vectorcraft_ui_egui::panels::color::{Mode, components, convert_to, from_components, hex_digits, parse_hex, show, web_safe}; // This integration binary contains only these tests; its app-wide CMS is independent of other // test binaries. Serialize its cases and restore settings even when an assertion fails. @@ -186,3 +188,169 @@ fn color_panel_slider_preserves_native_channels_and_undo() { harness.state_mut().run("edit.undo", json!({})).unwrap(); native(harness.state().session.proxy_paints().0.color().unwrap(), [0.5, 0.3, 0.2]); } + +/// An ordinary selected rectangle for Color panel hover and Shift-click checks. +fn spectrum_app() -> VectorcraftApp { + 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": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + app +} + +/// Every string actually painted by a headless frame, including a settled hover tooltip. +fn spectrum_painted_texts(output: &egui::FullOutput) -> Vec { + fn collect(shape: &egui::Shape, texts: &mut Vec) { + match shape { + egui::Shape::Text(t) => texts.push(t.galley.text().to_string()), + egui::Shape::Vec(shapes) => shapes.iter().for_each(|shape| collect(shape, texts)), + _ => {} + } + } + let mut texts = vec![]; + output.shapes.iter().for_each(|shape| collect(&shape.shape, &mut texts)); + texts +} + +/// Draw the real Color panel and return a point over its spectrum and the frame's text. +fn spectrum_frame( + app: &mut VectorcraftApp, + ctx: &egui::Context, + time: f64, + events: Vec, + modifiers: egui::Modifiers, +) -> (egui::Pos2, Vec) { + let screen = Rect::from_min_size(egui::Pos2::ZERO, vec2(260.0, 700.0)); + let events = std::iter::once(egui::Event::ModifiersChanged(modifiers)).chain(events).collect(); + let mut at = None; + let input = egui::RawInput { screen_rect: Some(screen), time: Some(time), events, ..Default::default() }; + let mut output = ctx.run_ui(input, |ui| { + show(app, ui); + at = if app.ui.color_hide_options { + // The existing hidden-options spectrum test uses this point right of the proxy. + let row = ui.min_rect(); + Some(egui::pos2(row.right() - 4.0, row.center().y)) + } else { + ctx.read_response(ui.scope_id().with("color-spectrum")).map(|r| r.rect.center()) + }; + }); + output.textures_delta.clear(); + (at.expect("the spectrum is drawn"), spectrum_painted_texts(&output)) +} + +/// The panel's drawn text after the pointer has rested on or away from the spectrum. +fn spectrum_hover_texts(app: &mut VectorcraftApp, ctx: &egui::Context, over: bool) -> (egui::Pos2, Vec) { + let away = egui::pos2(255.0, 695.0); + let time = ctx.input(|i| i.time) + 1.0; + let none = egui::Modifiers::NONE; + let (at, _) = spectrum_frame(app, ctx, time, vec![egui::Event::PointerMoved(away)], none); + let pos = if over { at } else { away }; + spectrum_frame(app, ctx, time + 0.1, vec![egui::Event::PointerMoved(pos)], none); + // Allow the tooltip delay and its following layout pass, as the Appearance panel tests do. + spectrum_frame(app, ctx, time + 2.0, vec![], none); + (at, spectrum_frame(app, ctx, time + 2.1, vec![], none).1) +} + +#[test] +fn spectrum_tooltip_names_its_displayed_mode() { + let _space = WorkingSpace::new(SRGB); + for hidden in [false, true] { + for mode in [Mode::Grayscale, Mode::Rgb, Mode::Hsb, Mode::Cmyk, Mode::WebSafe, Mode::Lab] { + let mut app = spectrum_app(); + let color = convert_to(mode, &Color::rgb8(51, 102, 153)); + app.run("paint.setFill", json!({"color": color_json(&color), "keepModel": true})).unwrap(); + // Lab follows the selected paint even when the stored mode is RGB. + app.ui.color_mode = Some(if mode == Mode::Lab { Mode::Rgb } else { mode }); + app.ui.color_hide_options = hidden; + let ctx = egui::Context::default(); + ctx.global_style_mut(|style| style.interaction.tooltip_delay = 0.1); + let paints = app.session.proxy_paints(); + let undo = app.session.active().unwrap().history.undo.len(); + let (_, away) = spectrum_hover_texts(&mut app, &ctx, false); + assert!(!away.iter().any(|text| text == mode.label()), "{mode:?}, hidden {hidden}: no tooltip away from the spectrum: {away:?}"); + let (_, hovered) = spectrum_hover_texts(&mut app, &ctx, true); + assert_eq!( + hovered.iter().filter(|text| text.as_str() == mode.label()).count(), + 1, + "{mode:?}, hidden {hidden}: the tooltip names the displayed mode: {hovered:?}" + ); + let (_, away) = spectrum_hover_texts(&mut app, &ctx, false); + assert!(!away.iter().any(|text| text == mode.label()), "{mode:?}, hidden {hidden}: the tooltip hides again: {away:?}"); + assert_eq!(app.session.proxy_paints(), paints, "hovering changes no paint"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "hovering adds no undo step"); + } + } +} + +#[test] +fn spectrum_tooltip_follows_shift_cycle_without_painting() { + let _space = WorkingSpace::new(SRGB); + for hidden in [false, true] { + let mut app = spectrum_app(); + app.run("paint.setFill", json!({"color": "#336699"})).unwrap(); + app.ui.color_mode = Some(Mode::Rgb); + app.ui.color_hide_options = hidden; + let ctx = egui::Context::default(); + ctx.global_style_mut(|style| style.interaction.tooltip_delay = 0.1); + let paints = app.session.proxy_paints(); + let undo = app.session.active().unwrap().history.undo.len(); + let (pos, hovered) = spectrum_hover_texts(&mut app, &ctx, true); + assert!(hovered.iter().any(|text| text == "RGB")); + let modifiers = egui::Modifiers::SHIFT; + let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers }; + let time = ctx.input(|i| i.time) + 1.0; + spectrum_frame(&mut app, &ctx, time, vec![egui::Event::PointerMoved(pos), button(true)], modifiers); + spectrum_frame(&mut app, &ctx, time + 0.1, vec![button(false)], modifiers); + spectrum_frame(&mut app, &ctx, time + 0.2, vec![], egui::Modifiers::NONE); + assert_eq!(app.ui.color_mode, Some(Mode::Hsb)); + let (_, hovered) = spectrum_hover_texts(&mut app, &ctx, true); + assert!(hovered.iter().any(|text| text == "HSB") && !hovered.iter().any(|text| text == "RGB"), "hidden {hidden}: {hovered:?}"); + assert_eq!(app.session.proxy_paints(), paints, "RGB to HSB changes no paint"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "cycling to HSB adds no undo step"); + } +} + +/// Spectrum hover text uses the selected UI language, in both panel layouts. +#[test] +fn spectrum_tooltip_uses_the_interface_language() { + use vectorcraft_ui_egui::i18n::{self, Lang}; + + // i18n is process-global in this integration binary. Every case holds the CMS lock. + // Restore the language before WorkingSpace releases that lock, including after a panic. + let _space = WorkingSpace::new(SRGB); + struct Language(Lang); + impl Drop for Language { + fn drop(&mut self) { + i18n::set_current(self.0); + } + } + let _language = Language(i18n::current()); + let german = Lang::from_code("de").unwrap(); + let mode = Mode::Grayscale; + let expected = "Graustufen"; + assert_eq!(i18n::tr(german, mode.label()), expected, "use an existing, distinct catalog translation"); + + for hidden in [false, true] { + let mut app = spectrum_app(); + app.session.prefs.interface_language = german.code().into(); + // The host normally does this in tick_frame; this harness draws the panel directly. + assert_eq!(app.ui_language(), german); + i18n::set_current(app.ui_language()); + let color = convert_to(mode, &Color::rgb8(51, 102, 153)); + app.run("paint.setFill", json!({"color": color_json(&color), "keepModel": true})).unwrap(); + app.ui.color_mode = Some(mode); + app.ui.color_hide_options = hidden; + let ctx = egui::Context::default(); + ctx.global_style_mut(|style| style.interaction.tooltip_delay = 0.1); + let paints = app.session.proxy_paints(); + let undo = app.session.active().unwrap().history.undo.len(); + let (_, away) = spectrum_hover_texts(&mut app, &ctx, false); + assert!(!away.iter().any(|text| text == expected), "hidden {hidden}: no translated tooltip away: {away:?}"); + let (_, hovered) = spectrum_hover_texts(&mut app, &ctx, true); + assert_eq!(hovered.iter().filter(|text| text.as_str() == expected).count(), 1, "hidden {hidden}: translated tooltip: {hovered:?}"); + assert!(!hovered.iter().any(|text| text == mode.label()), "hidden {hidden}: no untranslated tooltip: {hovered:?}"); + let (_, away) = spectrum_hover_texts(&mut app, &ctx, false); + assert!(!away.iter().any(|text| text == expected), "hidden {hidden}: translated tooltip hides again: {away:?}"); + assert_eq!(app.session.proxy_paints(), paints, "translated hover changes no paint"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "translated hover adds no undo step"); + } +} diff --git a/docs/roadmap.md b/docs/roadmap.md index 70e7e6661a..68b609734d 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -238,6 +238,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours | 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. | | 2026-11-15 | minor | M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimates unchanged | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | +| 2026-11-14 | minor | Color panel: the spectrum names its displayed mode on hover, including after Shift-click mode changes and with Hide Options enabled (part of #7235). Spectrum rendering and vertical resizing remain open. Scores and estimates unchanged. | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | | 2026-11-15 | minor | G12: Swatches item menus validated in all five views: 39 focused tests passed, regression fails without the menu hooks, rendered list/thumbnail layouts inspected, and fresh local deep CodeRabbit review found zero issues. Full workspace CI passed on Linux/WSL on the merged branch (all 13 gates), including the test-helper correction for the upstream compile error tracked in #7727; native Windows full CI has two unchanged engine-test failures. Scores and estimates unchanged. | | 2026-11-12 | minor | Gujarati (`gu`): 4,286-row machine-assisted catalog reviewed by a native speaker, zero/one singular plurals, desktop font fallback and optional Gujarati craft-fonts fallback; all 72 translation tests pass; a web font and about 2,600 untranslated messages remain; scores and estimates unchanged | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 2e708a4673..4653e40fc6 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1863,6 +1863,9 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Swatch library and Recolor Artwork parameters:** the `swatch.library.*` commands, `swatch.resetDefaults`, the graphic style library save, load and add, the `recolor.*` commands and `color.harmony`'s `limitTo` refuse parameters of the wrong form, such as `names: "Grays"`, `limitTo: 5` or `includeImages: "false"`. Errors name the parameter, except that a `limitTo` that is not a string, such as `5`, gets an unknown-library error. A `null` counts as left out except for `recolor.apply`'s `model`, which must be a string when given. - **Color Wheel panel (part of #978):** Window › Color Wheel shows the Fill and Stroke proxy beside a hue ring around a square with saturation across and brightness up. It edits what the Color panel's sliders edit (the active proxy's color, the selected gradient stop or freeform point) through the same paint commands, and a drag is one undo step. Alt paints the other proxy, and Shift steps the ring by 45°. A pick goes from display sRGB into the working RGB space; an RGB, CMYK or Lab color keeps its model, and a Gray color or a tint of a global swatch becomes a process color in the document's color mode. A click gives the ring or the square the keyboard focus, and the arrow keys then step the color; both report their names and values to screen readers, and the Color Picker's color field takes the same keys. The panel menu's Box View puts a box in the wheel's place: a color field with a channel strip at its right for Hue, Saturation, Brightness, Red, Green or Blue (Box Channel), on the Color Picker's axes, kept with the preferences (`ui.colorWheel`); the strip and the Color Picker's channel slider take the arrow keys after a click. Scores and estimates are unchanged. - **Colour:** a Color Picker (colour field, H/S/B/R/G/B channel slider, HSB/RGB/Lab/CMYK fields, hex, web-only snapping, out-of-gamut correction); the Color panel shows a selected colour in its own model and, with nothing selected, the new-art defaults in the mode picked last, which it keeps between sessions; Alt-click paints the other proxy; proxies look through groups and show "?" for mixed paint; Invert, Complement, Apply Last Color (`,`) and Apply Last Gradient (`.`) keep the colour model; every paint command feeds the recent colours. The Color Guide has 21 harmony rules, Steps and Variation options and Limit to Library. Adjust Color Balance (its Global mode shifts tints) and Saturate preview live; Edit Colors and Recolor also reach meshes, images and patterns. Recolor Artwork has colour reduction, five recolour methods, presets, Limit to Library, a colour-wheel Edit tab and Edit Color Group; a local Color Themes panel saves five-colour themes. Fill/Stroke chips open swatch and mixer popovers (the Properties panel has the Control bar's Fill and Stroke chips, Stroke link and weight spinner, with nothing selected too), panels have Illustrator's Window menu keys (Align Shift+F7, Transform Shift+F8, Pathfinder Cmd+Shift+F9, Layers F7, Character Cmd+T…; every panel can be given one in Edit › Keyboard Shortcuts), and Eyedropper Options pick up and apply chosen attributes (Alt and Shift+Alt, image pixels). An ICC CMYK profile converts straight into the RGB working space (not through sRGB, so a wider space such as Wide Gamut RGB keeps colours sRGB can't hold) with the colour settings' black-point compensation, on the canvas and in RGB exports alike (the built-in Generic CMYK compensates both ways, so RGB black separated to a rich black displays as black again). Fills and strokes can overprint (Attributes panel, Overprint Black options), and CMYK documents blend in inks on screen, in PDF and when flattening. Document Color Mode converts the art, symbols, pattern tiles and swatches through the colour settings: Gray stays Gray, RGB grays separate into light grays in cyan, magenta and yellow only, darker four-color grays and a rich black, or go on the black plate only with `grays: "black"` (also for `document.open {colorMode}`). + + **Color panel spectrum mode tooltip (part of #7235):** hovering the spectrum names the displayed mode (Grayscale, RGB, HSB, CMYK, Web Safe RGB or Lab), including after Shift-clicking to switch modes and with Show Options or Hide Options. Hovering changes no paint or undo history. Spectrum rendering and vertical resizing remain open. Evidence: `spectrum_tooltip_names_its_displayed_mode` and `spectrum_tooltip_follows_shift_cycle_without_painting` in `crates/ui-egui/tests/color_working_components.rs`. Scores and estimates unchanged. + Plain Comma and Period, and also Shift+Comma and Shift+Period, apply the last solid color and the last gradient to the active Fill or Stroke proxy in VectorCraft ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), "Select color fill mode" and "Select gradient fill mode"). Recent Colors keeps the last 30 solid colors applied, newest first and each once, and the list stays the same when another document is opened or made active; a 31st color drops the oldest ([Select colors using the Color panel](https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/select-colors-using-the-color-panel.html)). The list lasts for the session. In the Color and Swatches panels the chips wrap onto further rows when the panel is too narrow for one row (`paint.recent`). Tests: `recent_colors_keep_thirty_colors_across_documents` in `crates/engine/src/tests/paintproxy.rs`, `all_thirty_recent_colors_wrap_into_a_narrow_panel` in `crates/ui-egui/src/panels/color/tests.rs`. Unchecking Show Recent Colors in the Color panel's menu hides its Recent Colors row, and checking it shows the row again ([Select colors using the Color panel](https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/select-colors-using-the-color-panel.html)). In VectorCraft the item is checked by default and kept between sessions, applied colors still join the list while the row is hidden, Hide Options hides the row either way, and the Swatches panel keeps its row (`ui.colorPanel {recentColors}`). Tests: `show_recent_colors_hides_and_shows_the_row` in `crates/ui-egui/src/panels/color/tests.rs`. @@ -2979,6 +2982,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-14 | minor | Paragraph composers (#4935): `text.setFormat {composer}` and paragraph styles take `singleLine` and `everyLine` (the Middle Eastern & South Asian composers, what all type used and the default) and `standardSingleLine` and `standardEveryLine`, which break lines the same way and set a complex script (Indic, Arabic, Hebrew) glyph by glyph as the font maps its characters, with no conjuncts, reordering, marks placed or joining forms. The choice is per paragraph, saved in the native file only when it is not Every-line, and not written to `.ai`, EPS or PDF files, whose composer setting this app has no recorded format for. Scores and estimates unchanged. Tests `tests::composers`. | +| 2026-11-14 | minor | Color panel: the spectrum names its displayed mode on hover, including after Shift-click mode changes and with Hide Options enabled (part of #7235). Spectrum rendering and vertical resizing remain open. Scores and estimates unchanged. | | 2026-11-14 | minor | G5: Weather Icons joins Basic Shapes, UI Frames, Map Markers, Inventory Icons and Skill Icons as a sixth built-in symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow; original procedural vector symbols generated in code, no default 9-slice); area score and estimate unchanged. | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | | 2026-11-15 | minor | G12: Swatches item menus validated in all five views: 39 focused tests passed, regression fails without the menu hooks, rendered list/thumbnail layouts inspected, and fresh local deep CodeRabbit review found zero issues. Full workspace CI passed on Linux/WSL on the merged branch (all 13 gates), including the test-helper correction for the upstream compile error tracked in #7727; native Windows full CI has two unchanged engine-test failures. Scores and estimates unchanged. |