diff --git a/crates/ui-egui/src/header_icon_size_tests.rs b/crates/ui-egui/src/header_icon_size_tests.rs index 35db827df..917276c2a 100644 --- a/crates/ui-egui/src/header_icon_size_tests.rs +++ b/crates/ui-egui/src/header_icon_size_tests.rs @@ -3,7 +3,7 @@ use egui::{Context, Rect, pos2, vec2}; -use crate::icons::Icon; +use crate::icons::{self, Icon}; use crate::widgets::{icon_button_at, icon_glyph_rect, section_header}; /// Bounding box of everything painted in one frame of `add`. @@ -24,22 +24,29 @@ fn painted_box(add: impl FnOnce(&mut egui::Ui)) -> Rect { .fold(Rect::NOTHING, |a, b| a.union(b)) } +/// The header's eye, `icon_button_at`'s and a fill row's (`icons::button`, the reporter's +/// reference) are drawn at one size. #[test] -fn header_eye_draws_as_large_as_an_icon_buttons_eye() { +fn header_eye_draws_as_large_as_a_fill_rows_eye() { let header = painted_box(|ui| { section_header(ui, "Appearance", &[(Icon::Eye, "Hide")], false); }); - let button = painted_box(|ui| { + let at = painted_box(|ui| { let r = Rect::from_min_size(pos2(20.0, 20.0), vec2(24.0, 24.0)); icon_button_at(ui, ui.scope_id().with("b"), r, Icon::Eye, "Hide"); }); - assert!(header.is_finite() && button.is_finite(), "{header:?} {button:?}"); - assert!((header.width() - button.width()).abs() < 0.5, "widths {} vs {}", header.width(), button.width()); - assert!((header.height() - button.height()).abs() < 0.5, "heights {} vs {}", header.height(), button.height()); + let row = painted_box(|ui| { + icons::button(ui, Icon::Eye, 24.0, false, "Toggle visibility"); + }); + for (name, b) in [("icon_button_at", at), ("icons::button", row)] { + assert!(header.is_finite() && b.is_finite(), "{header:?} {b:?}"); + assert!((header.width() - b.width()).abs() < 0.5, "{name}: widths {} vs {}", header.width(), b.width()); + assert!((header.height() - b.height()).abs() < 0.5, "{name}: heights {} vs {}", header.height(), b.height()); + } } #[test] fn glyph_rect_is_the_shared_inset_of_the_button() { let b = Rect::from_min_size(pos2(0.0, 0.0), vec2(24.0, 24.0)); - assert_eq!(icon_glyph_rect(b).size(), vec2(14.0, 14.0)); + assert_eq!(icon_glyph_rect(b).size(), vec2(16.0, 16.0)); } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 12cc02f14..79d0777f1 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -1045,9 +1045,10 @@ pub fn tight_end_n(ui: &mut Ui, count: usize, add: impl FnOnce(&mut Ui) -> R) add(&mut child) } -/// Inset of the glyph inside a 24 pt icon button: a 14 pt glyph, the size every icon button in the -/// panels draws at (section header buttons included). -pub const ICON_BUTTON_INSET: f32 = 5.0; +/// Inset of the glyph inside a 24 pt icon button: a 16 pt glyph, the icons' native size and what +/// `icons::button` draws (a fill row's eye), so every 24 pt icon button in the panels matches it +/// (section header buttons included). +pub const ICON_BUTTON_INSET: f32 = 4.0; /// The rect a 24 pt icon button paints its glyph in. pub fn icon_glyph_rect(button: Rect) -> Rect { diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 9412fb06f..b3f6506ac 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -200,7 +200,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | 2026-11-06 | patch | M7, #2032: closing a tab whose file has unsaved changes, by its X, a middle click, File ▸ Close tab or its shortcut, only showed a toast ("save first, or close again with Alt to discard") and left the tab open, so closing seemed not to work. It now asks the unsaved-changes question the window asks (`windows::TabClose`): Don't Save closes the tab, Cancel or Escape keeps it, Save saves the file and then closes it (a file without a path, or saved as .fig, asks where with Save as first and stays open if that is cancelled); Alt+close still drops the changes at once, and `file.close`'s `dialog.unsaved` request asks too. The three toasts left the catalogs. Tests: `titlebar_tests::closing_a_tab_with_unsaved_changes_asks`, `titlebar_tests::save_in_the_tab_question_saves_then_closes`. Reordering tabs by dragging, the issue's other half, landed on 2026-10-19 (`dragging_a_tab_along_the_bar_reorders_it_without_detaching`) | | 2026-11-05 | minor | M4, #1830: a paragraph's base direction can be forced (`TextDirection`: Auto, Ltr, Rtl on `ParaList`): Text ▸ Text direction ▸ Auto / Left to right / Right to left (`text.directionAuto` / `Ltr` / `Rtl`) and `text.direction {direction, ids?}` set the edited paragraphs while editing, else the layer's; `node.set textDirection`; the Type settings control once a right-to-left script is in the text; inspect `textDirection` / `lineDirections`; CSS `direction`; `.fig` lines' `sourceDirectionality` in and out. Layout gives each paragraph its base level (`Bidi::of` runs the algorithm per paragraph, as it starts over at each). Before, direction came from the letters only ("controls are available to override text direction per paragraph", Add right-to-left text). Tests: `text_behaviour_tests::text_direction_is_forced_per_paragraph`, `fig::text_direction_tests::a_lines_source_directionality_is_its_paragraphs_direction_both_ways`. | | 2026-11-02 | minor | M1, #1836: pick select. Tab while the keyboard selection box shows, or Alt/Ctrl+Space again, puts a pink outline on the first selected layer (the page's top layer with nothing selected); Tab and Shift+Tab move it between sibling layers as the Layers panel lists them, Enter into a frame's top child, Shift+Enter out to the parent (never the page), Space selects the layer under it, Escape or a press on the canvas ends it; the chord again while the pick cursor shows brings the box back (Accessibility at Figma). The control channel's `ui.key` sends the box's and the pick cursor's keys to them too. One documented row more (135, 134 bound); four gesture rows. Tests: `layers_keyboard_tests::tab_switches_the_selection_box_to_pick_select`. | -| 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 14 pt, not 12 pt; the Close and Swap buttons of the assets and prototype panels share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | +| 2026-11-10 | patch | M10, #2227: the Design panel's section header buttons (Appearance, Typography, Fill, Stroke, Effects) draw their icons at the size of the panel's other 24 pt icon buttons, 16 pt (the icons' native size, as a fill row's eye), not 12 pt; `icon_button_at` goes from 14 to 16 pt with them; the Close and Swap buttons of the assets and prototype panels share the inset. Test: `header_icon_size_tests`. Numbers unchanged. | | 2026-11-05 | patch | M1, #2003: the Design panel's boolean operation menu leads Union, Subtract, Intersect and Exclude with original icons drawn in code (two offset squares, the result filled at reduced alpha). Numbers unchanged. | | 2026-11-02 | minor | M8, #1875: a fill per region. With regions of a vector selected in edit mode (a press inside one with the Move tool, `vector.edit.select {regions}`), the Fill section lists the regions' own fills (the layer's for a region that has none; mixed content when they differ) and its rows and the colour picker edit them: `fill.set`, `fill.add`, `fill.remove`, `fill.move` and `fill.paste` on the edited layer go to the selected regions' stacks (`Region.fills`, what the renderer already draws), the layer's fills and fill style untouched; `regions: [index, ...]` names them on any vector layer (Edit vector layers). Tests: `regions_tests::the_fill_commands_edit_the_selected_regions`. Numbers unchanged. | | 2026-11-05 | patch | M1, #1758: a mouse's side buttons (4 and 5) pan the canvas as the middle button does, the pan ending on release over the canvas or off it; the grab cursor shows while they're held. |