From 4fdb02fc5f2c968bca449c8bbd046747827c261c Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 9 Nov 2026 01:32:26 -0500 Subject: [PATCH] M8: a dragged layer moves with its outline: drawn from a sprite while the base stays put (#2033) While a drag only translates plain layers on the threaded render worker, the dragged layers are rendered once into a texture of their own and drawn each frame at the same shift as the selection outline. The base is rendered once without them, from the document the drag started from, and no further render is asked for until the drag ends. On release, cancel or a zoom change the whole document is rendered again and the sprite stays until that image is shown. Trade-offs while dragging: the sprite draws above everything, blends against the background are approximated, and layers outside the conditions keep the old path. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium --- crates/ui-egui/src/canvas.rs | 26 ++- crates/ui-egui/src/canvas/drag_sprite.rs | 237 +++++++++++++++++++++++ crates/ui-egui/src/canvas/render.rs | 25 ++- crates/ui-egui/src/canvas_drag_tests.rs | 81 ++++++++ docs/ui-parity.md | 4 +- 5 files changed, 366 insertions(+), 7 deletions(-) create mode 100644 crates/ui-egui/src/canvas/drag_sprite.rs diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 251ff25e6..94045a0c8 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -15,6 +15,7 @@ use crate::render_worker::{Done, Job, Worker}; use crate::theme::{COMPONENT, Tokens, doc_c32, regular, semibold}; mod builder; +mod drag_sprite; mod input; mod outline; mod overlays; @@ -58,6 +59,10 @@ pub struct CanvasState { /// The request the texture answers ([`crate::render_worker::Done::seq`]). tex_seq: u64, submitted: Option, + /// The dragged layers drawn from a texture of their own while the base render stays put + /// ([`drag_sprite`]), and the gesture (its start document's address) that can't have one. + sprite: Option, + sprite_declined: usize, /// The view of the last render asked for. want_view: Option, /// What the last canvas render had to do (shown by `ui.inspect`). @@ -89,6 +94,19 @@ pub struct CanvasState { wheel_is_mouse: bool, } +#[cfg(test)] +impl CanvasState { + /// The layers the last submitted canvas job leaves out. + pub(crate) fn submitted_skip(&self) -> Option<&[NodeId]> { + self.submitted.as_ref().map(|k| k.skip.as_slice()) + } + + /// Where the drag sprite shows on screen (at one pixel per point), if there is one. + pub(crate) fn sprite_rect(&self, app: &FigApp) -> Option { + drag_sprite::screen_rect(app, 1.0) + } +} + impl Default for CanvasState { fn default() -> Self { Self { @@ -99,6 +117,8 @@ impl Default for CanvasState { tex_coarse: false, tex_seq: 0, submitted: None, + sprite: None, + sprite_declined: 0, want_view: None, render_work: None, preview_latency_ms: None, @@ -260,7 +280,8 @@ pub fn show(app: &mut FigApp, ui: &mut Ui, worker: &mut Worker) { }) .unwrap_or(t.canvas); let dots = crate::board_bar::dots(app, bg, &t); - request_render(app, worker, ppp, max_texture_side, dots); + request_render(app, worker, &ctx, ppp, max_texture_side, dots); + drag_sprite::drop_orphan(&mut app.canvas); // Every finished render is shown, even when a newer one is already on its way: renders finish // in order, and an edit every frame (a drag) would otherwise never show until it stopped. let shown = app.session.ds().map(|ds| (ds.uid, ds.page)).ok(); @@ -281,6 +302,7 @@ pub fn show(app: &mut FigApp, ui: &mut Ui, worker: &mut Worker) { Some(t) => t.set(done.image, filter), None => app.canvas.texture = Some(ctx.load_texture("figcraft-canvas", done.image, filter)), } + let done_at = done.at; let latency = Some(done.at.elapsed().as_secs_f64() * 1000.0); if done.coarse { app.canvas.preview_latency_ms = latency; @@ -291,6 +313,7 @@ pub fn show(app: &mut FigApp, ui: &mut Ui, worker: &mut Worker) { app.canvas.tex_of = Some((done.uid, done.page)); app.canvas.tex_coarse = done.coarse; app.canvas.tex_seq = done.seq; + drag_sprite::arrived(&mut app.canvas, done_at, done.coarse); } let painter = ui.painter_at(rect); painter.rect_filled(rect, CornerRadius::ZERO, bg); @@ -303,6 +326,7 @@ pub fn show(app: &mut FigApp, ui: &mut Ui, worker: &mut Worker) { let image_rect = presented_image_rect(tl, v, zoom, ppp, pixel_preview); painter.image(tex.id(), image_rect, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); } + drag_sprite::draw(app, &painter, ppp); crate::dev_mode::refresh_measurements(app); app.session.tool.labels = overlays(app, &painter, &t); crate::frame_labels::rename_field(app, ui); diff --git a/crates/ui-egui/src/canvas/drag_sprite.rs b/crates/ui-egui/src/canvas/drag_sprite.rs new file mode 100644 index 000000000..8e9035076 --- /dev/null +++ b/crates/ui-egui/src/canvas/drag_sprite.rs @@ -0,0 +1,237 @@ +//! The dragged-subtree sprite (#2033). The selection outline is drawn from the live document every +//! frame, but the canvas shows the last image the render worker finished, so while a layer is +//! dragged the content trails the outline by the render time of every pointer move. When a +//! gesture only translates plain layers ([`crate::selection_cache::moved`]), the layers are +//! rendered once into a texture of their own (the sprite) and drawn each frame at the same +//! shifted place as the outline, while the base render is made once without them +//! ([`figcraft_render::Options::skip`]) from the document the gesture started from, so no render +//! is requested again until the gesture ends. +//! +//! While it drags, the sprite draws above everything (the layers lose their z-order), blends and +//! backdrop effects against what lies under them are approximated, and a layer that doesn't +//! qualify (see [`plan`]) keeps the old way. + +use std::sync::Arc; + +use egui::{Color32, Rect, pos2}; +use figcraft_color::BlendMode; +use figcraft_doc::{Document, NodeId, NodeKind}; +use web_time::Instant; + +use super::{CanvasState, FigApp}; + +/// The sprite is at most this many times the canvas in pixels. +const MAX_AREA_FACTOR: f64 = 4.0; + +pub(super) struct Sprite { + tex: egui::TextureHandle, + /// The dragged layers. + roots: Vec, + /// Where the first of them was, in page units (the final shift is read off its move). + root_at: (f64, f64), + /// The page area the sprite shows when not shifted, and its pixels. + view: figcraft_render::View, + /// The pointer-driven shift (page units) while it drags, then the final one. + delta: (f64, f64), + zoom: f64, + ppp: f32, + /// The address of the document the gesture started from. + base: usize, + /// Page rectangle the layers are clipped to (the clipping frames above them). + clip: Option, + /// The gesture is over (or the plan stopped holding): the sprite stays until the image of the + /// document without a skip, asked for at or after `release`, is on screen. + ending: bool, + release: Option, +} + +impl Sprite { + fn rect(&self, app: &FigApp, ppp: f32) -> Rect { + let tl = app.to_screen(self.view.origin.0 + self.delta.0, self.view.origin.1 + self.delta.1); + let zoom = app.session.ds().map(|d| d.view.zoom).unwrap_or(self.zoom); + super::presented_image_rect(tl, &self.view, zoom, ppp, false) + } +} + +/// Where the sprite shows on screen now, if there is one (tests compare it with the outline). +#[cfg(test)] +pub(super) fn screen_rect(app: &FigApp, ppp: f32) -> Option { + app.canvas.sprite.as_ref().map(|s| s.rect(app, ppp)) +} + +/// Draw the sprite, above the canvas image. +pub(super) fn draw(app: &FigApp, painter: &egui::Painter, ppp: f32) { + let Some(s) = &app.canvas.sprite else { return }; + let r = s.rect(app, ppp); + let painter = match s.clip { + Some(c) => { + let (a, b) = (app.to_screen(c.x0, c.y0), app.to_screen(c.x1, c.y1)); + painter.with_clip_rect(painter.clip_rect().intersect(Rect::from_two_pos(a, b))) + } + None => painter.clone(), + }; + painter.image(s.tex.id(), r, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); +} + +/// A finished image of the canvas, asked for at `at`, is on screen: a sprite that is ending goes. +pub(super) fn arrived(c: &mut CanvasState, at: Instant, coarse: bool) { + if !coarse && c.sprite.as_ref().is_some_and(|s| s.ending && s.release.is_some_and(|r| at >= r)) { + c.sprite = None; + } +} + +/// A job without a skip was asked for at `at`: what an ending sprite waits for. +pub(super) fn released_at(c: &mut CanvasState, at: Instant) { + if let Some(s) = c.sprite.as_mut().filter(|s| s.ending) { + s.release = Some(at); + } +} + +/// An ending sprite no job waits on goes (nothing would ever replace it). +pub(super) fn drop_orphan(c: &mut CanvasState) { + if c.sprite.as_ref().is_some_and(|s| s.ending && s.release.is_none()) { + c.sprite = None; + } +} + +/// Bring the sprite in line with the gesture; the document and layers the canvas render is to be +/// made from, with the layers skipped, while it shows them. +pub(super) fn sync(app: &mut FigApp, ctx: &egui::Context, ppp: f32, max_side: u32) -> Option<(Arc, Vec)> { + if cfg!(target_arch = "wasm32") { + return None; + } + let Ok(ds) = app.session.ds() else { + app.canvas.sprite = None; + return None; + }; + let moved = crate::selection_cache::moved(ds); + let zoom = ds.view.zoom; + let view_ok = view_allows(ds); + if let Some(s) = app.canvas.sprite.as_mut().filter(|s| !s.ending) { + if let Some((base, d)) = moved.as_ref().filter(|(b, _)| Arc::as_ptr(b) as usize == s.base) + && zoom.to_bits() == s.zoom.to_bits() + && ppp.to_bits() == s.ppp.to_bits() + && view_ok + { + s.delta = *d; + return Some((base.clone(), s.roots.clone())); + } + // The gesture ended or the plan stopped holding (then not again in this gesture): freeze + // where the layers are now. + if let Some((b, _)) = moved.as_ref().filter(|(b, _)| Arc::as_ptr(b) as usize == s.base) { + app.canvas.sprite_declined = Arc::as_ptr(b) as usize; + } + match ds.doc.world_transform(s.roots[0]).translation() { + t if ds.doc.contains(s.roots[0]) => { + s.delta = (t.x - s.root_at.0, t.y - s.root_at.1); + s.ending = true; + s.release = None; + } + _ => app.canvas.sprite = None, + } + } + let (base, _) = moved?; + let ptr = Arc::as_ptr(&base) as usize; + if app.canvas.sprite_declined == ptr || !view_ok { + return None; + } + let canvas_px = f64::from(app.canvas.rect.width() * ppp) * f64::from(app.canvas.rect.height() * ppp); + match plan(ctx, &base, &ds.selection, zoom, ppp, max_side, canvas_px) { + Some(s) => { + let out = (base, s.roots.clone()); + app.canvas.sprite = Some(s); + Some(out) + } + None => { + app.canvas.sprite_declined = ptr; + None + } + } +} + +/// What the canvas shows that the sprite can't stand in for. +fn view_allows(ds: &figcraft_engine::DocState) -> bool { + !ds.view.outlines + && !ds.view.outlines_selection + && !ds.view.outline_hidden + && ds.focused().is_none() + && ds.view.pixel_preview_scale().is_none() + && !(ds.view.proof_srgb && !ds.doc.color_profile.is_srgb()) +} + +/// Normal, or the pass-through of groups and frames (which draws like it unless the layers in them blend). +fn ordinary(b: BlendMode) -> bool { + matches!(b, BlendMode::Normal | BlendMode::PassThrough) +} + +/// Whether layer `id` can be drawn apart from the rest: it and what it sits in are plain. +fn plain(doc: &Document, id: NodeId, clip: &mut Option) -> bool { + let Some(n) = doc.node(id) else { return false }; + if !n.effects.is_empty() || !ordinary(n.blend) || n.is_mask { + return false; + } + let Some(parent) = n.parent.and_then(|p| doc.node(p)) else { return false }; + if matches!(parent.kind, NodeKind::BooleanOp { .. }) || parent.children.iter().any(|c| doc.node(*c).is_some_and(|c| c.is_mask)) { + return false; + } + let mut at = Some(parent.id); + while let Some(a) = at.and_then(|a| doc.node(a)) { + if matches!(a.kind, NodeKind::Page { .. }) { + break; + } + if !a.effects.is_empty() || !ordinary(a.blend) || a.opacity < 1.0 || a.is_mask { + return false; + } + if a.clip && a.kind.is_frame_like() { + let Some(b) = doc.world_bounds(a.id) else { return false }; + *clip = Some(clip.map_or(b, |c| c.intersect(b))); + } + at = a.parent; + } + true +} + +/// Render the dragged layers of `base` into a sprite, if they qualify: the roots are plain (see +/// [`plain`]), none inside another, and the sprite fits a texture and a few canvases of pixels. +fn plan(ctx: &egui::Context, base: &Arc, sel: &[NodeId], zoom: f64, ppp: f32, max_side: u32, canvas_px: f64) -> Option { + if sel.is_empty() || !zoom.is_finite() || zoom <= 0.0 { + return None; + } + let mut clip = None; + for id in sel { + if !plain(base, *id, &mut clip) || sel.iter().any(|o| o != id && base.ancestors(*id).contains(o)) { + return None; + } + } + // Bottom to top, as the page draws them. + let page = base.page_of(sel[0])?; + let order = base.subtree(page); + let mut roots: Vec = order.iter().copied().filter(|i| sel.contains(i)).collect(); + if roots.len() != sel.len() { + roots = sel.to_vec(); + } + let bounds = roots.iter().filter_map(|i| base.world_render_bounds(*i)).reduce(|a, b| a.union(b))?; + let scale = zoom * f64::from(ppp); + let (w, h) = ((bounds.width() * scale).ceil(), (bounds.height() * scale).ceil()); + let side = f64::from(max_side); + if !(w >= 1.0 && h >= 1.0 && w <= side && h <= side && w * h <= canvas_px * MAX_AREA_FACTOR) { + return None; + } + let pix = figcraft_render::render_area(base, &roots, bounds, scale)?; + let view = figcraft_render::View { origin: (bounds.x0, bounds.y0), scale, width: pix.width(), height: pix.height() }; + let tex = ctx.load_texture("figcraft-drag-sprite", crate::render_worker::screen_image(&pix, base.color_profile), egui::TextureOptions::LINEAR); + let t = base.world_transform(roots[0]).translation(); + Some(Sprite { + tex, + root_at: (t.x, t.y), + roots, + view, + delta: (0.0, 0.0), + zoom, + ppp, + base: Arc::as_ptr(base) as usize, + clip, + ending: false, + release: None, + }) +} diff --git a/crates/ui-egui/src/canvas/render.rs b/crates/ui-egui/src/canvas/render.rs index c6c4702fa..11658708f 100644 --- a/crates/ui-egui/src/canvas/render.rs +++ b/crates/ui-egui/src/canvas/render.rs @@ -10,7 +10,7 @@ pub(super) struct JobKey { outline: bool, outline_extras: figcraft_render::Outline, outlined: Vec, - skip: Vec, + pub(super) skip: Vec, solo: Option, /// Text lays out anew when fonts arrive (system fonts load in the background). fonts: u64, @@ -46,7 +46,16 @@ fn covers(outer: &figcraft_render::View, inner: &figcraft_render::View) -> bool o.x0 <= i.x0 + eps && o.y0 <= i.y0 + eps && o.x1 >= i.x1 - eps && o.y1 >= i.y1 - eps } -pub(super) fn request_render(app: &mut FigApp, worker: &mut Worker, ppp: f32, max_texture_side: u32, dots: Option) { +pub(super) fn request_render( + app: &mut FigApp, + worker: &mut Worker, + ctx: &egui::Context, + ppp: f32, + max_texture_side: u32, + dots: Option, +) { + // A dragged layer drawn as a sprite: the render is of the document the drag started from, without it. + let sprite = super::drag_sprite::sync(app, ctx, ppp, max_texture_side); let Ok(ds) = app.session.ds() else { return }; let rect = app.canvas.rect; let (mut ox, mut oy) = ds.view.origin(); @@ -60,7 +69,10 @@ pub(super) fn request_render(app: &mut FigApp, worker: &mut Worker, ppp: f32, ma (ds.view.zoom * f64::from(ppp), (rect.width() * ppp).ceil().max(1.0) as u32, (rect.height() * ppp).ceil().max(1.0) as u32) }; // The edited text is drawn live (an IME composition included); the caret is an overlay. - let doc = app.preedit_view().map(|p| p.doc.clone()).unwrap_or_else(|| ds.doc.clone()); + let (doc, skip) = match sprite { + Some(s) => s, + None => (app.preedit_view().map(|p| p.doc.clone()).unwrap_or_else(|| ds.doc.clone()), vec![]), + }; let outlined = if ds.view.outlines_selection { ds.selection.clone() } else { vec![] }; let proof = ds.view.proof_srgb && !doc.color_profile.is_srgb(); let outline_extras = figcraft_render::Outline { hidden: ds.view.outline_hidden, bounds: ds.view.outline_bounds, light: false }; @@ -81,7 +93,7 @@ pub(super) fn request_render(app: &mut FigApp, worker: &mut Worker, ppp: f32, ma outline: ds.view.outlines, outline_extras, outlined: outlined.clone(), - skip: vec![], + skip: skip.clone(), solo: ds.focused(), fonts: figcraft_text::layout_generation(), proof, @@ -105,7 +117,7 @@ pub(super) fn request_render(app: &mut FigApp, worker: &mut Worker, ppp: f32, ma outline: ds.view.outlines, outline_extras, outlined, - skip: vec![], + skip, solo: key.solo, proof, dots, @@ -114,6 +126,9 @@ pub(super) fn request_render(app: &mut FigApp, worker: &mut Worker, ppp: f32, ma at: web_time::Instant::now(), }; app.canvas.want_view = Some(job.view.clone()); + if job.skip.is_empty() { + super::drag_sprite::released_at(&mut app.canvas, job.at); + } worker.submit(job); app.canvas.submitted = Some(key); } diff --git a/crates/ui-egui/src/canvas_drag_tests.rs b/crates/ui-egui/src/canvas_drag_tests.rs index 9f3b38397..e46ccae9a 100644 --- a/crates/ui-egui/src/canvas_drag_tests.rs +++ b/crates/ui-egui/src/canvas_drag_tests.rs @@ -121,3 +121,84 @@ fn a_drag_released_off_the_window_ends_where_the_pointer_was_last_seen_and_later assert!(!doc.contains(gone), "the delete stays"); assert_eq!(doc.node(text).unwrap().kind.text().unwrap().characters, "B"); } + +/// A frame with a child, selected, and the screen point of an empty spot in it. +fn frame_with_child(effects: bool) -> (Ui, figcraft_doc::NodeId, egui::Pos2) { + let mut s = Session::new(); + let id = |v: serde_json::Value| figcraft_engine::params::id_of(&v["id"]).unwrap(); + let f = id(s.execute("frame.create", &json!({"x": 100, "y": 100, "width": 300, "height": 200})).unwrap()); + s.execute("shape.rectangle", &json!({"x": 40, "y": 40, "width": 80, "height": 60, "parent": f, "props": {"fill": "#e03030"}})).unwrap(); + if effects { + s.execute("node.set", &json!({"ids": [f], "effects": [{"type": "dropShadow", "color": "#00000066", "offset": [0, 8], "radius": 24}]})) + .unwrap(); + } + s.execute("select.set", &json!({"ids": [f]})).unwrap(); + let mut u = Ui::new(s); + settle(&mut u); + let p = u.app.to_screen(350.0, 250.0); + (u, f, p) +} + +fn drag_frames(u: &mut Ui, p: egui::Pos2, n: u32) { + for k in 1..=n { + u.frame(vec![Event::PointerMoved(p + vec2(k as f32 * 7.0, k as f32 * 3.0))]); + } +} + +#[test] +fn dragging_a_plain_frame_draws_its_sprite_with_the_outline() { + let (mut u, f, p) = frame_with_child(false); + u.button(p, true); + drag_frames(&mut u, p, 4); + assert!(u.app.canvas.sprite_rect(&u.app).is_some(), "the sprite exists"); + assert_eq!(u.app.canvas.submitted_skip(), Some(&[f][..]), "the base render leaves the dragged layer out"); + settle(&mut u); + // The sprite and the outline come from the same shift in the same frame. + for k in 5..9 { + u.frame(vec![Event::PointerMoved(p + vec2(k as f32 * 7.0, k as f32 * 3.0))]); + let ds = u.app.session.ds().unwrap(); + let (base, (dx, dy)) = crate::selection_cache::moved(ds).expect("a plain move"); + let b = figcraft_engine::tools::selection_box(&base, &[f]).unwrap(); + let outline = u.app.to_screen(b[0].x + dx, b[0].y + dy); + let sprite = u.app.canvas.sprite_rect(&u.app).unwrap(); + assert!((sprite.min - outline).length() < 0.6, "sprite {:?} outline {outline:?}", sprite.min); + } + // The base stays put: later moves ask for no new render. + settle(&mut u); + let before = u.app.canvas.submitted_skip().map(<[_]>::to_vec); + u.frame(vec![Event::PointerMoved(p + vec2(90.0, 40.0))]); + assert_eq!(u.app.canvas.submitted_skip().map(<[_]>::to_vec), before); + assert!(!u.app.worker.as_ref().is_some_and(|w| w.in_flight()), "no render for a move"); + u.button(p + vec2(90.0, 40.0), false); + u.frame(vec![]); + assert_eq!(u.app.canvas.submitted_skip(), Some(&[][..]), "the whole document is rendered again"); + settle(&mut u); + u.frame(vec![]); + assert!(u.app.canvas.sprite_rect(&u.app).is_none(), "the sprite goes once that render is shown"); +} + +#[test] +fn a_frame_with_effects_on_itself_keeps_the_old_path() { + let (mut u, _f, p) = frame_with_child(true); + u.button(p, true); + drag_frames(&mut u, p, 4); + assert!(u.app.canvas.sprite_rect(&u.app).is_none()); + assert_eq!(u.app.canvas.submitted_skip(), Some(&[][..])); + u.button(p + vec2(30.0, 10.0), false); +} + +#[test] +fn zooming_during_a_drag_ends_the_fast_path() { + let (mut u, _f, p) = frame_with_child(false); + u.button(p, true); + drag_frames(&mut u, p, 4); + assert!(u.app.canvas.sprite_rect(&u.app).is_some()); + let z = u.app.session.ds().unwrap().view.zoom; + u.app.session.ds_mut().unwrap().view.zoom = z * 1.5; + u.frame(vec![Event::PointerMoved(p + vec2(40.0, 12.0))]); + assert_eq!(u.app.canvas.submitted_skip(), Some(&[][..]), "the zoom ended it"); + // Not started again by the next move of the same gesture. + u.frame(vec![Event::PointerMoved(p + vec2(48.0, 15.0))]); + assert_eq!(u.app.canvas.submitted_skip(), Some(&[][..])); + u.button(p + vec2(48.0, 15.0), false); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 463be3b47..a70de28ce 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-04 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-09 · **Change:** minor (a dragged layer is drawn from a sprite that moves with its outline (#2033); the left rail's and tab strip's icons are larger, 20 pt (#553); pick select: Tab while the keyboard selection box shows (or the chord again) puts a pink outline on a layer and the keys walk the layer tree from it, as Accessibility at Figma says (#1836); scrubbing a field faster or slower by the pointer's height, with a notice of the speed, as the help center's Scrub fields says (#1837); component rows in the Layers panel at AA contrast in the theme's component tint, with the rows inside a selected component in a tone of its row (#1903); Cmd/Ctrl-click on a padding field sets all four sides with the value typed, a documented auto layout shortcut; a fill per region of a vector: with regions selected in edit mode, the Fill section and the fill commands edit those regions' own fills, as Edit vector layers says (#1875); the Fill section of a text whose characters were coloured differently while editing shows mixed content, characters that all share fills the layer doesn't have show those, and a layer-level fill edit reaches every character (#1856); a number field scrubs when dragged with Alt held, as the help center's scrub section says, not only by its label; reuse visible layer selection roots (M8); ; with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it, and Enter places there, as Accessibility at Figma says (#1839); text direction per paragraph: Text ▸ Text direction forces a paragraph left to right or right to left, as Add right-to-left text says (#1830), with `text.direction`, `node.set textDirection`, the Type settings control once a right-to-left script is in the text, inspect, the CSS `direction` and the `.fig` lines' `sourceDirectionality`; the boolean operation menu in the Design panel leads each entry with an original icon drawn in code, a filled preview of the result (#2003); a press on the open gradient's handles or stops on the canvas keeps the colour picker open through the drag, as its own control (#1852); a click with the Bend tool on a sharp point curves it, its handles along the line between its neighbours, as Edit vector layers says (#1875); wrap style: Auto, Balance and Pretty on a text layer decide where its lines break, as Explore text properties says (#1827), with the Type settings control, `text.wrapStyle`, `node.set wrapStyle`, inspect and the CSS `text-wrap`; Backspace or Delete at the start of a list item keeps the item's indentation level, as the lists article says; max lines on auto-width text keep it auto width, hugging that many lines, as the text properties article says; superscript and subscript are synthesised where the font has no glyphs for them, from the standard glyphs shrunk and shifted by the font's OS/2 metrics, and a run mixing available and unavailable glyphs is synthesised whole, as Explore text properties says (#1828); Alt+Enter while editing text opens the link at the caret, as the accessibility page documents; Minimize, by its shortcut or the button by the file name, collapses the navigation bar and both sidebars as the help center says, with the right sidebar back while something is selected (#1835); the interface size keys of the help center's accessibility page: Cmd/Ctrl+Shift+Alt with =, - and 0 step the interface through the Preferences sizes and back to the system's size; Cmd/Ctrl+Alt+arrows rotate the selection a degree at a time, 15 with Shift, as the help center's accessibility page says; they resized before; the Layers panel answers Ctrl+1 as well as Alt+1 on Windows and Linux, the two keys the help center gives it; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the keyboard's Menu key opens the context menu, as Shift+F10 does; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; sidebar number and text fields keep their text vertically centered when focused, including typography spacing; with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); colour picker review fixes for text undo, fitted sidebars, moving controls and gradient variables; Corner smoothing: an original icon and the shared number-field drag gesture, preserving fractional baselines; guides snap to layers when dragged; Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); the Design panel's sections on one grid — 16 / 8 margins, 88 + 8 + 88 + 8 + 24 columns, 24 pt rows, 4 pt between a row's buttons (#858); the toolbar on one 32 pt grid, without its Resources button (#1210); colour picker LCH and OKLCH models; an XML (Android Vector Drawable) export format; Context menus: the Menu key reaches egui 0.37 but is unbound (row done → partial); the Text on a path tool; board tool keys pinned; community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches) · **Target:** Figma Design UI3 (desktop app 126.10.7) 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: @@ -67,6 +67,7 @@ interaction feel not yet compared. | Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. With nothing selected, the arrows first show a crosshair in the middle of the view and then move it by the nudge amounts (`tool.crosshair`; Shift the large one), and Enter places there; Escape or a tool change takes it away ("Use the arrow keys to activate the crosshair cursor. It will appear in the middle of the viewport indicating where the new object will be placed", Accessibility at Figma; #1839) | | Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers) | | Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) | +| A dragged layer moves with its outline | partial | #2033: the canvas image is the last render the worker finished, so a drag's content trailed its outline by a render per pointer move (63 ms, about 3.6 frames, and 150 px on screen with drop shadows on 200 layers). While a gesture only translates plain layers (Normal or pass-through blend, no effects on them or above them, not masks, not in a boolean group or beside a mask, no ancestor under 100 percent opacity; their own children may have effects) the layers are rendered once into a texture of their own (the sprite), the base is rendered once without them from the document the drag started from and then asks for no more renders, and the sprite is drawn each frame at the same shifted place as the selection outline. On release, Escape or a zoom change the document is rendered whole again and the sprite stays until that image is shown. Desktop only (the browser renders in the same frame). Trade-offs while dragging: the sprite draws above everything (z-order is lost), blends and backdrop blurs against what is behind are approximated, ancestors' clips are applied as their bounding boxes, and a sprite wider than the texture limit or over four canvases of pixels, outline and focus views, pixel preview and soft proof keep the old way | `canvas/drag_sprite.rs` | | Scale tool (K): handles about an anchor, live factor, panel | done | | | Nudge 1 / Shift 10 (preference), Cmd+arrows resize | done | arrows reorder auto layout children | | Smart guides: edges, centres, equal spacing (between two layers or continuing a row's gap, labelled), spacing labels, parent, layout grid, ruler guides | done | red, `snap.rs`; a guide dragged out of a ruler or moved snaps to layer edges and centres too (Snap to Objects; Cmd/Ctrl suspends), on its own axis only; page guides see the page's top-level layers, frame guides the frame's box, layout grids and every layer in it, along a rotated frame's own axes; thresholds not yet compared with Figma's (`guide_snap_tests`) | @@ -187,6 +188,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look | Date | Change | Summary | |---|---|---| +| 2026-11-09 | patch | M8, #2033: a dragged layer moves with its outline: the layers a translate-only drag moves are drawn from a sprite (a texture rendered once at the start) at the same shift as the outline, and the base render, made once without them, is not asked for again until the drag ends (see the row "A dragged layer moves with its outline" for the conditions and trade-offs). | | 2026-11-02 | patch | Shortcuts: a Cmd/Ctrl-click on a padding field (the horizontal or vertical pair, or a side with Individual padding open) makes the value typed go to all four sides, in one undo step (Guide to auto layout, Keyboard shortcut guide); a plain click still edits that axis or side alone. A documented gesture row: 134 documented, 133 bound. Test: `padding_individual_tests` | | 2026-11-01 | patch | Number fields: dragging the field itself with Alt held scrubs it ("You can also hover the input field itself and hold down the modifier key: Mac: ⌥ Option Windows: Alt", Adjust alignment, rotation, position, and dimensions), with the resize cursor and the label's rates (Alt is the enabler there, so it isn't the fine rate); a click with Alt doesn't open the editor. Found by a documentation audit of the ui-parity rows. Test: `field_tests::alt_held_over_a_field_scrubs_it`. Counts unchanged | | 2026-11-02 | patch | M6, #1839: with a shape or frame tool chosen and nothing selected, the arrows show a placement crosshair in the middle of the view and move it by the nudge amounts (`tool.crosshair`), Enter places the object there (`tool.place`), Escape or a tool change takes it away; the canvas draws the crosshair and `ui.inspect` reports it (`tool.crosshair`), the Keyboard shortcuts panel lists the gesture ("Use the arrow keys to activate the crosshair cursor...", Accessibility at Figma). The board Shapes tool places on it too (its 160 px shape centred, as the tool centres a press), and the view pans by the overshoot when the crosshair is nudged past its edge. Tests: `place_crosshair_tests`, `shortcut_keys_tests::arrows_show_and_move_the_placement_crosshair_with_a_shape_tool`. |