M1: scrubbing a field hides the selection's frame until it is let go (#1319)

Changing a stroke weight, corner radius or any other value by scrubbing
its field left the selection's frame and handles over the layer, so the
result couldn't be judged without deselecting. While a field is scrubbed
(the shared widgets::scrub gesture, used by every number field and the
typography icons) the canvas now hides the selection's frame, handles
and size label, as it already did while the colour picker is used, and
draws them again once the drag is let go. A press without a drag leaves
them.
This commit is contained in:
bflatastic committed 2026-11-28 17:25:04 +07:00
1 parent febefdaabf
commit 681b8180ac
6 files changed
+57 -11

No files matched your search

+8
View File
@@ -72,6 +72,14 @@ impl FigApp {
}
}
/// Whether the canvas hides the selection's frame and a text's coloured selection right now:
/// while a field is scrubbed ([`crate::widgets::scrubbing`]) or the colour picker is used on
/// the selection ([`Self::picker_hides_selection`]), so the value being changed shows on the
/// layer itself.
pub(crate) fn hides_selection(&self, ctx: &egui::Context) -> bool {
crate::widgets::scrubbing(ctx) || self.picker_hides_selection(ctx)
}
/// Whether the colour picker is being used right now for the selected layers' own look (a
/// paint, an effect, a text range or Selection colors): a drag on its value controls (the
/// palette, the hue and alpha sliders, a number field, the gradient bar and its stops), the
+8 -8
View File
@@ -124,10 +124,10 @@ pub(super) fn overlays(app: &FigApp, painter: &egui::Painter, t: &Tokens) -> Vec
}
// Selection.
let editing = ds.text_edit.clone();
// While the colour picker is being used on the selection, hide its frame and handles so the
// colour being picked shows on the layer itself (a text's coloured selection would hide it
// too).
if !sel.is_empty() && editing.is_none() && ds.vector_edit.is_none() && !app.picker_hides_selection(painter.ctx()) {
// While a field is scrubbed or the colour picker is used on the selection, hide its frame and
// handles so the value being changed shows on the layer itself (a text's coloured selection
// would hide it too).
if !sel.is_empty() && editing.is_none() && ds.vector_edit.is_none() && !app.hides_selection(painter.ctx()) {
size_label = selection_overlay(app, painter, ds, &doc, &sel, zoom);
}
if app.session.tool.tool == ToolId::ShapeBuilder
@@ -276,10 +276,10 @@ fn text_edit_overlay(app: &FigApp, painter: &egui::Painter, t: &Tokens, doc: &Do
let preedit = app.preedit_view();
let edoc: &Document = preedit.map(|p| &*p.doc).unwrap_or(doc);
let Some(text) = TextOnScreen::of(edoc, te.id) else { return };
// While the colour picker is being used on this text, its frame and coloured selection hide
// too: the selection colour tinted the very characters whose colour is being chosen. The
// caret stays.
let picking = app.picker_hides_selection(painter.ctx());
// While a field is scrubbed or the colour picker is used on this text, its frame and coloured
// selection hide too: the selection colour tinted the very characters being changed. The caret
// stays.
let picking = app.hides_selection(painter.ctx());
let layout = &text.layout;
if !picking && let Some(q) = node_quad(app, edoc, te.id) {
quad(painter, q, stroke(accent(painter), 1.0));
@@ -541,3 +541,27 @@ fn a_focused_palette_square_does_not_hide_the_selection() {
}
assert!(painted_around(&u.frame_output(vec![]), area, accent) > 0, "focus on a palette square leaves the frame in view");
}
// Scrubbing a field changes the layer live (#1319): its frame and handles step aside meanwhile, as
// they do for the colour picker, so the new value shows on the layer itself.
#[test]
fn scrubbing_a_field_hides_the_selections_frame_until_let_go() {
let mut s = Session::new();
let text = selected_text(&mut s);
let mut u = Ui::new(s);
let area = text_area(&u, text);
let accent = crate::theme::canvas_accent(&u.ctx);
u.ctx.enable_accesskit();
assert!(painted_around(&u.frame_output(vec![]), area, accent) > 0, "the selected text's frame shows");
let from = crate::field_tests::label(&mut u, "Rotation");
u.button(from, true);
assert!(painted_around(&u.frame_output(vec![]), area, accent) > 0, "a press on the label alone leaves the frame");
let mut to = from;
for _ in 0..4 {
to += egui::vec2(6.0, 0.0);
u.frame(vec![egui::Event::PointerMoved(to)]);
}
assert_eq!(painted_around(&u.frame_output(vec![]), area, accent), 0, "scrubbing hides the frame");
u.button(to, false);
assert!(painted_around(&u.frame_output(vec![]), area, accent) > 0, "letting go brings the frame back");
}
+1 -1
View File
@@ -204,7 +204,7 @@ pub(crate) fn field(u: &mut Ui, name: &str) -> (Pos2, String) {
}
/// The middle of field `name`'s label (what scrubs): just left of its value.
fn label(u: &mut Ui, name: &str) -> Pos2 {
pub(crate) fn label(u: &mut Ui, name: &str) -> Pos2 {
u.frame(vec![]);
let out = u.frame_output(vec![]);
let nodes = out.platform_output.accesskit_update.expect("an AccessKit update").nodes;
+13
View File
@@ -154,6 +154,17 @@ pub fn scrub_notice_id() -> Id {
Id::unique("scrub_speed_notice")
}
/// Where a scrub notes the last frame it moved a value in ([`scrubbing`]).
fn scrubbing_id() -> Id {
Id::unique("scrubbing_frame")
}
/// Whether a field is being scrubbed, this frame or the last (the panels may draw before or after
/// the canvas): the canvas hides the selection's frame meanwhile, so the value shows on the layer.
pub(crate) fn scrubbing(ctx: &egui::Context) -> bool {
ctx.data(|d| d.get_temp::<u64>(scrubbing_id())).is_some_and(|f| f + 1 >= ctx.cumulative_frame_nr())
}
/// The value a scrub that began at `from` and has moved `amount` (see [`scrub_amount`]) shows:
/// whole steps of `quantum` away from where it began.
pub fn scrubbed(from: f64, amount: f64, quantum: f64) -> f64 {
@@ -193,6 +204,8 @@ pub(crate) fn scrub(ui: &Ui, id: Id, response: &Response, value: Option<f64>, st
let (speed, notice) = scrub_speed(rise);
// The frame the button goes up moves nothing: the scrub ends where the last one left it.
if response.dragged() {
let frame = ui.ctx().cumulative_frame_nr();
ui.data_mut(|d| d.insert_temp(scrubbing_id(), frame));
amount += scrub_amount(dx, step, shift, alt) * speed;
// A change of speed is said once (not the usual speed a scrub starts at).
if notice != last_speed && !(last_speed.is_empty() && speed == 1.0) {
+3 -2
View File
@@ -1,6 +1,6 @@
# UI and interaction parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-28 · **Change:** minor (the Pencil, Marker, Highlighter and Eraser show a round tip in the ink's colour and width instead of a crosshair (#2641); the `` ` `` key chooses the code block tool on boards (#2237); Cmd/Ctrl+L copies a link to the selected layer, as in Figma; M4: the eyedropper colours the stroke of a layer that has only a stroke, samples for an open colour picker from the shortcut too, and shows the colour under it beside the pointer; Shift with a double-click goes a level deeper and keeps the rest of the selection, so layers nested in neighbouring artboards can be selected together; M1: Frame selection makes a frame without a fill; M1: centred auto-width text keeps its middle as it grows and shrinks; M1: a drag on a section's background, or on the background of a frame in it, draws a marquee; the Layers panel's eye and padlock stay at the list's right edge, and a name takes at most 400 pt; in vector edit mode, deleting a point selects the next one on its path, so Delete pressed again goes on along it; the hover and selection outline of a curved layer bends smoothly instead of showing straight pieces; text copied while editing, or a whole text layer copied, pastes into a text edit with its formatting and its layer's colour, and Shift+Cmd/Ctrl+V (also Alt+Cmd/Ctrl+V) pastes it in the style at the caret; crop mode: the layer's sides and corners crop its image in an auto layout frame too, up to the image's edges, change a locked ratio (Shift keeps it), the image's own corners scale freely with Shift proportional as a resize does, and crop mode and vector edit mode end each other; after a click on a layer row the arrow keys nudge the selection, or move a layer in an auto layout flow one place, as in Figma; the rows take the arrows once they have the keyboard (F6); Shift+Cmd/Ctrl+V with several layers selected pastes after the last of them as seen: next in an auto layout frame's flow, else below the lowest or right of the rightmost, at the selection's own gap; Tab and Shift+Tab while editing a text layer go on to the next or previous text layer of its frame, in reading order, with all of its text selected; a file opens again on the page and at the view it was left at; the desktop app reopens the files open when it quit, in their tabs' order with the same one in front, and with nothing to reopen starts on the Home screen instead of in a new file; a dropdown, button menu or context menu in the panels that is taller than the window scrolls, so its last rows can be picked; frames, sections, components and instances move, resize and draw on whole pixels whatever Snap to pixel grid says and whatever they snap to, as Figma's help says; the pixel grid shows on a dark canvas and dark fills as well as on white, its lines one screen pixel wide in a light grey at a fifth of its strength, as measured in Figma; Shift+Cmd/Ctrl+' says at the bottom of the window whether snapping to the pixel grid is now on or off; Paste properties links the copied layer's colour, effect, grid and text styles and binds the variables it follows, and a frame's layout grids come along; links another file lacks paste as values; mind maps from the toolbar and the keyboard: Shapes ▸ Mind map places one with a click, Cmd/Ctrl+Enter adds a child and Shift+Cmd/Ctrl+Enter a sibling, Tab goes to the next sibling (#2226); a dragged layer is drawn from a sprite that moves with its outline (#2033); the Scale tool keeps variable-bound lengths scaled: a scaled instance keeps its bindings and draws them at the variable's value times its scale factor, other scaled layers keep the scaled value and drop the binding (#2090); Type settings ▸ Details ▸ Position sets the selected text layers, or the selected characters while editing, to superscript or subscript, or neither (#2338); Shift with the Pencil, Marker or Highlighter draws one straight segment from where the stroke started, at the nearest 45° step, as the Line tool and the Pen do (#2447); the Design panel's header names a selected component or component set, after its icon, instead of only its type (#2347); dragging near the canvas edge pans the view toward it, as measured in Figma: 40 px/s for each px within about 15 px of the edge, 600 px/s at it, for moving layers, the selection box, drawing and prototype connections (#2015); M8: a Shift-click range in the Layers panel across parents keeps a frame and not its covered children, measured in Figma's web app on 2026-11-12; points align and distribute in vector edit mode as in Figma: the six Align commands, the keys Alt+A/H/D/W/V/S, and Distribute horizontal and vertical spacing act on the selected points, each moving along one axis to their box's edge or centre line, spaced evenly between the outermost for distribute, with the alignment row first in the Design panel (#2109); going back to a page shows it where it was left, not fitted again; Duplicate repeats the last copy's move anLine truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-28 · **Change:** minor (while a field is scrubbed the selection's frame and handles hide, so the value shows on the layer, as they already did while the colour picker is used (#1319); the Pencil, Marker, Highlighter and Eraser show a round tip in the ink's colour and width instead of a crosshair (#2641); the `` ` `` key chooses the code block tool on boards (#2237); Cmd/Ctrl+L copies a link to the selected layer, as in Figma; M4: the eyedropper colours the stroke of a layer that has only a stroke, samples for an open colour picker from the shortcut too, and shows the colour under it beside the pointer; Shift with a double-click goes a level deeper and keeps the rest of the selection, so layers nested in neighbouring artboards can be selected together; M1: Frame selection makes a frame without a fill; M1: centred auto-width text keeps its middle as it grows and shrinks; M1: a drag on a section's background, or on the background of a frame in it, draws a marquee; the Layers panel's eye and padlock stay at the list's right edge, and a name takes at most 400 pt; in vector edit mode, deleting a point selects the next one on its path, so Delete pressed again goes on along it; the hover and selection outline of a curved layer bends smoothly instead of showing straight pieces; text copied while editing, or a whole text layer copied, pastes into a text edit with its formatting and its layer's colour, and Shift+Cmd/Ctrl+V (also Alt+Cmd/Ctrl+V) pastes it in the style at the caret; crop mode: the layer's sides and corners crop its image in an auto layout frame too, up to the image's edges, change a locked ratio (Shift keeps it), the image's own corners scale freely with Shift proportional as a resize does, and crop mode and vector edit mode end each other; after a click on a layer row the arrow keys nudge the selection, or move a layer in an auto layout flow one place, as in Figma; the rows take the arrows once they have the keyboard (F6); Shift+Cmd/Ctrl+V with several layers selected pastes after the last of them as seen: next in an auto layout frame's flow, else below the lowest or right of the rightmost, at the selection's own gap; Tab and Shift+Tab while editing a text layer go on to the next or previous text layer of its frame, in reading order, with all of its text selected; a file opens again on the page and at the view it was left at; the desktop app reopens the files open when it quit, in their tabs' order with the same one in front, and with nothing to reopen starts on the Home screen instead of in a new file; a dropdown, button menu or context menu in the panels that is taller than the window scrolls, so its last rows can be picked; frames, sections, components and instances move, resize and draw on whole pixels whatever Snap to pixel grid says and whatever they snap to, as Figma's help says; the pixel grid shows on a dark canvas and dark fills as well as on white, its lines one screen pixel wide in a light grey at a fifth of its strength, as measured in Figma; Shift+Cmd/Ctrl+' says at the bottom of the window whether snapping to the pixel grid is now on or off; Paste properties links the copied layer's colour, effect, grid and text styles and binds the variables it follows, and a frame's layout grids come along; links another file lacks paste as values; mind maps from the toolbar and the keyboard: Shapes ▸ Mind map places one with a click, Cmd/Ctrl+Enter adds a child and Shift+Cmd/Ctrl+Enter a sibling, Tab goes to the next sibling (#2226); a dragged layer is drawn from a sprite that moves with its outline (#2033); the Scale tool keeps variable-bound lengths scaled: a scaled instance keeps its bindings and draws them at the variable's value times its scale factor, other scaled layers keep the scaled value and drop the binding (#2090); Type settings ▸ Details ▸ Position sets the selected text layers, or the selected characters while editing, to superscript or subscript, or neither (#2338); Shift with the Pencil, Marker or Highlighter draws one straight segment from where the stroke started, at the nearest 45° step, as the Line tool and the Pen do (#2447); the Design panel's header names a selected component or component set, after its icon, instead of only its type (#2347); dragging near the canvas edge pans the view toward it, as measured in Figma: 40 px/s for each px within about 15 px of the edge, 600 px/s at it, for moving layers, the selection box, drawing and prototype connections (#2015); M8: a Shift-click range in the Layers panel across parents keeps a frame and not its covered children, measured in Figma's web app on 2026-11-12; points align and distribute in vector edit mode as in Figma: the six Align commands, the keys Alt+A/H/D/W/V/S, and Distribute horizontal and vertical spacing act on the selected points, each moving along one axis to their box's edge or centre line, spaced evenly between the outermost for distribute, with tLine truncated
Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys,
drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status:
@@ -77,7 +77,7 @@ interaction feel only partly compared: the interactions measured so far, case by
| Ctrl to suspend snapping while dragging (macOS) | done | Control on macOS (Cmd keeps working), Ctrl elsewhere; moving, resizing and drawing |
| Measure (Alt hover, Cmd+Alt nested, Shift+Alt padding/gaps) | done | labels never overlap; the arrows still nudge while measuring (Shift: the big step) and the distances follow; the selection's handles and size label hide while measuring (`measure_nudge_tests`, #894) |
| Pixel grid snapping, pixel preview, 2x preview | done | moves, resizes and new shapes land on whole pixels; frames, sections and components always do, also with snapping off or next to a layer off the grid, as the help says (`frames_land_on_whole_pixels_whatever_they_snap_to`); the pixel grid shows from 400% (`view_behaviour_tests`) |
| Numeric fields: arithmetic, scrubbing by dragging the label (or the field itself with Alt held), mixed values | done | Numeric panels use `widgets::number_field`; Corner smoothing has an original code-drawn icon, a 24 pt drag target and an accessible name, with live changes, fractional values preserved across consecutive drags, Shift/Alt rates, 0–100% clamping and one-step undo/redo (`corner_individual_tests`); Typography line height, letter spacing and paragraph spacing share its leading-icon scrub logic (#373), retaining their existing unit parsing, Auto/Mixed values, variable chips and selected-character targeting (`typography_scrub_tests`). Scrubbing the label: half a step a point (0.5 px; 0.5% of opacity, 0.5° of rotation), as measured in Figma on 2026-11-08 (a 12.2 px drag moved X by 6, a 61.2 px drag by 31; rotation by 6° and opacity by 5% for 12.2 px), ten times that with Shift (5 steps a point) and a tenth of that with Alt (0.05 steps a point; neither measured), each stretch at the rate held while it was dragged, one undo step when let go; past the edge of the screen it goes on where the platform reports the mouse's own motion (desktop), otherwise it stops there. Arrow keys: Up/Down step a pixel field by the small nudge and Shift by the big nudge (the preferences), other fields by their own step and ten of it; they work while typing (from what is typed) and with the keyboard on the field. Typing: `+ - * /`, brackets, units (`px`, `°`, `%`, `x`, `ms`), a decimal comma; `+10`, `*2`, `/4` are relative to the value, and `50%`, `+10%`, `-10%` too in a field that isn't a percentage. Enter, Tab or a click elsewhere commits (Tab and Shift+Tab move to the next and previous control), Escape restores; a field left as it was commits nothing (no undo step, and a rounded display isn't written back). Mixed values show "Mixed": a number sets them all, a relative edit or an arrow key goes to each layer from its own value in one undo step, for X, Y, W, H, rotation, opacity, corner radius and stroke weight (elsewhere `+10` on Mixed sets 10 and `*2` does nothing) (`field_tests`). Left: scrubbing a Mixed field (nothing happens), `x2`-style suffix edits, the pointer isn't wrapped to the other side of the screen; the Shift and Alt rates and the speed by height are not compared with Figma's, and the rotation scrub's direction is not confirmed; while scrubbing, the pointer's height sets the speed (more than 100 points above where the scrub began: 2x; that far below: 1/2; twice as far: 1/4), a toast names the speed when it changes, and Shift and Alt multiply as before ("Change the speed that you scrub the field by moving the cursor towards the top of the screen to increase the scrubbing speed, or towards the bottom of the screen to reduce it", Scrub fields; #1837) |
| Numeric fields: arithmetic, scrubbing by dragging the label (or the field itself with Alt held), mixed values | done | Numeric panels use `widgets::number_field`; Corner smoothing has an original code-drawn icon, a 24 pt drag target and an accessible name, with live changes, fractional values preserved across consecutive drags, Shift/Alt rates, 0–100% clamping and one-step undo/redo (`corner_individual_tests`); Typography line height, letter spacing and paragraph spacing share its leading-icon scrub logic (#373), retaining their existing unit parsing, Auto/Mixed values, variable chips and selected-character targeting (`typography_scrub_tests`). Scrubbing the label: half a step a point (0.5 px; 0.5% of opacity, 0.5° of rotation), as measured in Figma on 2026-11-08 (a 12.2 px drag moved X by 6, a 61.2 px drag by 31; rotation by 6° and opacity by 5% for 12.2 px), ten times that with Shift (5 steps a point) and a tenth of that with Alt (0.05 steps a point; neither measured), each stretch at the rate held while it was dragged, one undo step when let go; past the edge of the screen it goes on where the platform reports the mouse's own motion (desktop), otherwise it stops there. Arrow keys: Up/Down step a pixel field by the small nudge and Shift by the big nudge (the preferences), other fields by their own step and ten of it; they work while typing (from what is typed) and with the keyboard on the field. Typing: `+ - * /`, brackets, units (`px`, `°`, `%`, `x`, `ms`), a decimal comma; `+10`, `*2`, `/4` are relative to the value, and `50%`, `+10%`, `-10%` too in a field that isn't a percentage. Enter, Tab or a click elsewhere commits (Tab and Shift+Tab move to the next and previous control), Escape restores; a field left as it was commits nothing (no undo step, and a rounded display isn't written back). Mixed values show "Mixed": a number sets them all, a relative edit or an arrow key goes to each layer from its own value in one undo step, for X, Y, W, H, rotation, opacity, corner radius and stroke weight (elsewhere `+10` on Mixed sets 10 and `*2` does nothing) (`field_tests`). Left: scrubbing a Mixed field (nothing happens), `x2`-style suffix edits, the pointer isn't wrapped to the other side of the screen; the Shift and Alt rates and the speed by height are not compared with Figma's, and the rotation scrub's direction is not confirmed; while scrubbing, the pointer's height sets the speed (more than 100 points above where the scrub began: 2x; that far below: 1/2; twice as far: 1/4), a toast names the speed when it changes, and Shift and Alt multiply as before ("Change the speed that you scrub the field by moving the cursor towards the top of the screen to increase the scrubbing speed, or towards the bottom of the screen to reduce it", Scrub fields; #1837). While a field is scrubbed, the canvas hides the selection's frame, handles and size label (and a text's coloured selection), so the value being changed shows on the layer, and brings them back when it is let go (#1319, `colorpicker_selection_tests::scrubbing_a_field_hides_the_selections_frame_until_let_go`) |
| Transform box at small sizes | done | a press inside a layer smaller than its handles moves it, the nearest handle wins, handles answer just outside and are hidden under 16 px on screen; cursors follow each handle and the box's rotation |
| Locked layers | done | selectable from the layers panel; no handles, not dragged with the rest of a selection |
| Edit ▸ Set default properties: new layers take the selected layer's properties | done | from a shape (any layer but text): new rectangles, ellipses, polygons and stars drawn or clicked with their tools take its fills, strokes and their settings, effects, opacity, blend and corners; from a text layer: new text from the Text tool takes its fills and font (#2028). Silent in the help center on frames, lines and arrows: they keep their own look, as do layers made by commands; the defaults last for the session |
@@ -212,6 +212,7 @@ This audit records candidates for subsequent fixes; their behaviour is unchanged
| Date | Change | Summary |
|---|---|---|
| 2026-11-28 | patch | M1, #1319: changing a value by scrubbing its field left the selection's frame and handles over the layer, so a stroke weight or corner radius couldn't be judged without deselecting. While a field is scrubbed (`widgets::scrub`, every number field and the typography icons) the canvas now hides the selection's frame, handles and size label, as it already did while the colour picker is used, and brings them back when the drag is let go. A press on a label without a drag leaves them. Test: `colorpicker_selection_tests::scrubbing_a_field_hides_the_selections_frame_until_let_go`. Numbers unchanged |
| 2026-11-28 | patch | M3, #2507: Cmd/Ctrl+L with nothing selected copied nothing. It now copies the link of the page shown (`figcraft://node/<page id>`, what the pages list's Copy link to page copies), with the same "Link copied" toast; with a selection it still copies the selected layer's link. Test: `context_menu_tests::cmd_l_with_nothing_selected_copies_the_pages_link` |
| 2026-11-28 | patch | M12, #2641: the Pencil (and the board's Marker, Highlighter and Eraser) showed a crosshair. Its cursor is now the ink's tip: a dot in the colour its stroke takes there, as wide on screen as the stroke, ringed white and dark; the Eraser's is a ring of its reach. Tests: `cursor_tests::each_tool_has_its_cursor_by_modifier_and_what_is_under_the_pointer`, `cursors_tests::the_ink_tools_show_a_dot_in_the_inks_colour_and_width`. |
| 2026-11-28 | patch | M12, #2237: the code block tool takes the `` ` `` key on boards (`tool.codeBlock`), pinned like the other board tool keys (60 undocumented bindings). Test: `shortcut_parity_tests::counts_match_the_docs`. |