From 2f37809bf6d51d78a90f0672e539e040dece3c03 Mon Sep 17 00:00:00 2001 From: datatimp <12644819+datatimp@users.noreply.github.com> Date: Mon, 16 Nov 2026 19:12:53 -0500 Subject: [PATCH] Layers panel: the Alt-drag copy cursor is the panels' add cursor, so Windows shows the plus (#8217) --- crates/tools/src/cursors.toml | 2 +- crates/ui-egui/src/cursors.rs | 6 +++--- crates/ui-egui/src/panels/layers.rs | 7 ++++++- crates/ui-egui/src/panels/layers/tests.rs | 25 +++++++++++++++-------- docs/target-app-parity.md | 2 +- docs/ui-parity.md | 2 +- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/crates/tools/src/cursors.toml b/crates/tools/src/cursors.toml index 8eb377d48f..bc1e48508c 100644 --- a/crates/tools/src/cursors.toml +++ b/crates/tools/src/cursors.toml @@ -75,7 +75,7 @@ group = "Selection" shown_when = [ "The Group Selection tool: each click selects the next enclosing group.", "Direct Selection with Alt held (Alt makes it Group Selection for the next click).", - "Over a panel where a click adds something, such as the strip under the Gradient panel's ramp, where a click adds a stop (where the system has no copy cursor the app can show).", + "Over a panel where a click or a drop adds something, such as the strip under the Gradient panel's ramp, where a click adds a stop, or the Layers panel's list while rows are Alt-dragged, where the drop adds copies (where the system has no copy cursor the app can show).", ] hotspot = "The arrow's tip." look = "ArrowHollow with a plus badge." diff --git a/crates/ui-egui/src/cursors.rs b/crates/ui-egui/src/cursors.rs index 9f10dfeaaf..5e2b92e0e9 100644 --- a/crates/ui-egui/src/cursors.rs +++ b/crates/ui-egui/src/cursors.rs @@ -771,9 +771,9 @@ pub fn os_cursors(build: bool, wayland: bool) -> bool { build && !wayland } -/// The cursor a panel shows where a click adds something, such as a stop under the Gradient -/// panel's ramp: the white arrow with a plus that Group Selection shows for a click that adds the -/// next group. Windows has no system copy cursor (winit shows the plain arrow for +/// The cursor a panel shows where a click or a drop adds something, such as a stop under the +/// Gradient panel's ramp or a copy of rows Alt-dragged in the Layers panel (#8217): the white arrow +/// with a plus that Group Selection shows for a click that adds the next group. Windows has no system copy cursor (winit shows the plain arrow for /// `CursorIcon::Copy`), so where the window shows glyphs as OS cursors ([`os_cursors`]) the panel /// hands it this glyph; elsewhere (macOS, Wayland, the web, `VECTORCRAFT_SYSTEM_CURSORS`) the /// system's copy cursor shows (#8241). Set every frame it shows: the canvas and egui reset it. diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 5b465bbade..6e8c2648fa 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -384,7 +384,12 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { && let Some(drag) = egui::DragAndDrop::payload::(ui.ctx()) && let Some(cursor) = drag_cursor(&drag, alt, over_list) { - ui.ctx().set_cursor_icon(cursor); + // The copy cursor is the panels' add cursor, which Windows can show (#8217, #8241). + if cursor == egui::CursorIcon::Copy { + crate::cursors::set_add_cursor(app, ui.ctx()); + } else { + ui.ctx().set_cursor_icon(cursor); + } } // Keyboard: Delete removes the highlighted rows while the panel has the keyboard (a row was // clicked last, not the canvas). diff --git a/crates/ui-egui/src/panels/layers/tests.rs b/crates/ui-egui/src/panels/layers/tests.rs index 70dbd2a9d4..19475d73d8 100644 --- a/crates/ui-egui/src/panels/layers/tests.rs +++ b/crates/ui-egui/src/panels/layers/tests.rs @@ -1493,17 +1493,25 @@ fn dragging_rows_moves_them_into_other_layers_and_alt_copies() { let _ = (layer, c); } -/// One headless frame of the panel with `events` (Alt held when `alt`) → the cursor it asks for. -fn cursor_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec, alt: bool) -> egui::CursorIcon { +/// One headless frame of the panel with `events` (Alt held when `alt`) → the cursor it asks for, +/// and the cursor bitmap it hands the OS, if any. +fn cursor_frame( + app: &mut VectorcraftApp, + ctx: &egui::Context, + events: Vec, + alt: bool, +) -> (egui::CursorIcon, Option) { let mut events = events; events.insert(0, egui::Event::ModifiersChanged(egui::Modifiers { alt, ..Default::default() })); let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui)); out.textures_delta.clear(); - out.platform_output.cursor_icon + (out.platform_output.cursor_icon, out.platform_output.cursor_image) } /// #8217: a row dragged over the list shows the copy cursor while Alt is held, as the drop then -/// copies, and the grabbing hand otherwise, following Alt as it goes down and up mid-drag. +/// copies, and the grabbing hand otherwise, following Alt as it goes down and up mid-drag. The copy +/// cursor is the panels' add cursor (#8241): where the window shows glyphs as OS cursors (Windows, +/// X11, which have no system copy cursor winit can show), the white arrow with a plus. #[test] fn alt_shows_the_copy_cursor_while_rows_are_dragged() { let (mut app, _) = nested(); @@ -1515,11 +1523,12 @@ fn alt_shows_the_copy_cursor_while_rows_are_dragged() { frame(&mut app, &ctx, vec![egui::Event::PointerMoved(from)], false); frame(&mut app, &ctx, vec![button(from, true)], false); frame(&mut app, &ctx, vec![egui::Event::PointerMoved(from + vec2(0.0, 6.0))], false); - assert_eq!(cursor_frame(&mut app, &ctx, vec![egui::Event::PointerMoved(to)], false), egui::CursorIcon::Grabbing, "a move"); - assert_eq!(cursor_frame(&mut app, &ctx, vec![], true), egui::CursorIcon::Copy, "Alt held: the drop copies"); - assert_eq!(cursor_frame(&mut app, &ctx, vec![], false), egui::CursorIcon::Grabbing, "Alt let go: a move again"); + let glyph = crate::cursors::add_cursor_is_a_glyph(&app).then(|| app.canvas.cursors.get(vectorcraft_tools::Cursor::GroupSelection, 1.0)).flatten(); + assert_eq!(cursor_frame(&mut app, &ctx, vec![egui::Event::PointerMoved(to)], false), (egui::CursorIcon::Grabbing, None), "a move"); + assert_eq!(cursor_frame(&mut app, &ctx, vec![], true), (egui::CursorIcon::Copy, glyph), "Alt held: the drop copies"); + assert_eq!(cursor_frame(&mut app, &ctx, vec![], false), (egui::CursorIcon::Grabbing, None), "Alt let go: a move again"); cursor_frame(&mut app, &ctx, vec![button(to, false)], false); - assert_ne!(cursor_frame(&mut app, &ctx, vec![], true), egui::CursorIcon::Copy, "no drag, no copy cursor"); + assert_ne!(cursor_frame(&mut app, &ctx, vec![], true).0, egui::CursorIcon::Copy, "no drag, no copy cursor"); } /// The selected-art square copies with Alt as rows do; off the list (the trash, New Layer) Alt diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index aaf08162e3..8b245b9c1e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -960,7 +960,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Screen readers get the value of the color and channel sliders that panels and dialogs draw (the Color panel, the Color Picker, Swatch Options, the Navigator's Zoom, the Character panel's variable font axes, the Perspective Grid and flattener options, and the sliders of the effect, tool option and transform dialogs): the number and text of the field beside each one, such as 128 for G or 50% for an opacity, with the slider's range, which extends to include a number past the slider's end. The harmony wheel's Brightness slider, which has no field, reports its brightness in percent. - A layer whose Layer Options › Print is off shows its name italic in the Layers panel, and while its row is dragged, as the reference application shows non-printing layers (#5739); a printing layer stays upright and ticking Print again restores the upright name (`panels::layers` test `a_layer_that_does_not_print_has_its_name_italic`). - In the Layers panel only the primary mouse button drags. A drag with the right or middle button on a row, a guide row, the selection square, the eye or lock column or a target circle moves, copies, hides, locks and transfers nothing and records no undo step, and a right-click still opens the row's menu (`panels::layers` test `only_the_primary_button_drags_rows_guides_art_columns_and_appearances`). - - Rows or the selection square dragged over the Layers panel's list show the copy cursor while Alt is held, as the drop then copies, and the grabbing hand otherwise; the cursor follows Alt pressed or released mid-drag. Over the trash and New Layer, which delete or duplicate with or without Alt, the hand stays, and guide rows keep their own cursor (#8217; `panels::layers` tests `alt_shows_the_copy_cursor_while_rows_are_dragged` and `drag_cursor_shows_a_copy_only_where_the_drop_copies`). + - Rows or the selection square dragged over the Layers panel's list show the copy cursor while Alt is held, as the drop then copies, and the grabbing hand otherwise; the cursor follows Alt pressed or released mid-drag. The copy cursor is the panels' add cursor (#8241): on Windows and X11, which have no system copy cursor winit can show, the white arrow with a plus. Over the trash and New Layer, which delete or duplicate with or without Alt, the hand stays, and guide rows keep their own cursor (#8217; `panels::layers` tests `alt_shows_the_copy_cursor_while_rows_are_dragged` and `drag_cursor_shows_a_copy_only_where_the_drop_copies`). - Rows dragged in the Layers panel and held within 28 points of the list's top or bottom edge scroll a long list that way, faster nearer the edge (60 points a second at the band's inner side, 340 at the edge, at every frame rate), and keep scrolling while the pointer stays still, so a row out of view can take the drop (a move, or a copy with Alt); the Libraries panel's list scrolls by the same rule. In a list view shorter than 56 points each band is half the view, so a pointer in the top half scrolls up, one in the bottom half scrolls down, and a pointer just outside the view does not scroll it toward the far edge. A pointer beside the list, a drag of the eye or lock column and a release stop the scrolling, and scrolling changes nothing in the document. The band and speeds are VectorCraft's own (`panels::layers` tests `rows_held_near_the_bottom_or_top_edge_scroll_the_list_to_a_row_out_of_view`, `a_held_row_scrolls_the_list_as_far_in_the_same_time_at_any_frame_rate` and `the_list_scrolls_only_for_rows_held_over_it`; `panels` test `drag_scrolling_in_a_short_list_goes_toward_the_nearer_edge`). - The other panels' item drags start only with the primary mouse button too: swatches and color groups, brushes, symbols, graphic styles, library items and groups, character and paragraph styles, Appearance rows and its thumbnail, the Fill and Stroke squares, Recent Colors and the Gradient panel's thumbnail. A right or middle drag on one carries nothing, moves, copies, deletes and applies nothing and records no undo step; right-click menus and the Graphic Styles panel's held right-button preview stay as they were (`panels::swatches` test `only_a_primary_drag_moves_swatches_and_groups`, `panels::text_styles` test `only_a_primary_drag_carries_a_style_row`, `panels::tests_symbol_libraries` test `only_a_primary_drag_carries_a_library_symbol_out`, `panels::tests_effectedit` test `only_a_primary_drag_carries_the_thumbnail_or_a_row`). - Panels undock (#495): a dock tab, a panel icon or a popped-out panel's title dragged out of the dock floats that panel (in an OS window of its own on the desktop, #4135), and the strip right of the dock's tabs floats the whole tabbed group. A floating group moves by its title bar, a tab dragged out of it floats on its own, and dropped on another group's title bar or tabs it stacks with that group; dropped on a dock group's tabs, which light up under the pointer, its panels join that group, and on the group's upper or lower half they make a new group above or below it (`window.panel.dock {anchor, zone}`); dropped on the icon column they become icons there, the tabbed group's panels too (`window.panel.dock {icon: true}`); dropped anywhere else on the dock, which lights up, they go back where they live (the tabbed group or the icon column), as its × and the panel menus' Float Panel / Dock Panel do (`window.panel.float`, `window.panel.dock`). The Tools panel floats by its title bar and docks again on the window's left edge. Floating groups stack into sets: dropped on the upper or lower half of another group (a line shows where), a group joins it right above or below it, and the set's groups stack top to bottom, each showing one panel, moving together by the top group's title bar, whose × docks them all; a group dragged by its tab strip leaves the set (`window.panel.float {below, above}`). A double-click on a tab collapses a floating group to its tabs (`collapsed`), and a dock group too, a group below it moving up into the room; a second double-click, or a click on another of its tabs, expands it (`window.panel.collapse`, kept with the preferences and in saved workspaces). Sets dropped on the left edge of the icon column or of another dock column dock as dock columns (a multi-column dock, `window.panel.dock {column}`), whose groups stack, tab and tear out as a floating set's do, and whose top strip floats the column again. Floating panels, their sets and the Tools panel's position are kept with the preferences and in user workspaces, and clamped into a smaller window. Not done: panels in separate OS windows, reordering tabs by dragging, collapsing a set or dock column to icons, dock columns right of the default dock, resizing floating panels and the groups of a set. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 7c81e51f76..bd77f6fd39 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -184,7 +184,7 @@ tools, never checked side by side) isn't captured row by row. | Swatches list fills a taller panel (#1638) | done | Docked, floating or in a resized flyout, the swatch list takes the height above the panel's footer, as the Artboards list does; outside a sized panel it stays 150 pt (200 pt for large thumbnails); `the_list_fills_a_tall_panel_above_its_footer` in `panels/swatches/tests.rs` | | Layers panel lists a blend's spine (#4820) | done | an open blend shows a `` row below its key objects, where Release leaves the spine; a click selects the blend (Shift/Cmd toggles it) so Direct Selection edits the spine; a locked blend's row selects nothing; no row while searching or filtering (`a_blends_spine_is_a_row_below_its_keys_that_selects_the_blend`) | | Layers panel: a layer whose Layer Options › Print is off shows its name italic (#5739) | done | the panel row and its drag ghost; a printing layer stays upright, and Print on again restores it; `panels::layers` test `a_layer_that_does_not_print_has_its_name_italic` | -| Layers panel: Alt-drag shows the copy cursor (#8217) | done | rows and the selected-art square dragged over the list show the copy cursor while Alt is held and the grabbing hand otherwise, following Alt mid-drag; over the trash and New Layer, which ignore Alt, the hand stays; guide rows keep theirs; `alt_shows_the_copy_cursor_while_rows_are_dragged`, `drag_cursor_shows_a_copy_only_where_the_drop_copies` | +| Layers panel: Alt-drag shows the copy cursor (#8217) | done | rows and the selected-art square dragged over the list show the copy cursor while Alt is held and the grabbing hand otherwise, following Alt mid-drag; on Windows and X11 the copy cursor is the white arrow with a plus (the panels' add cursor, #8241); over the trash and New Layer, which ignore Alt, the hand stays; guide rows keep theirs; `alt_shows_the_copy_cursor_while_rows_are_dragged`, `drag_cursor_shows_a_copy_only_where_the_drop_copies` | | Gradient panel: add-stop cursor under the ramp (#8241) | done | the white arrow with a plus (the Group Selection glyph) over the strip under the ramp, handed to the OS on Windows and X11 (winit shows the plain arrow for the system copy cursor there), the system copy cursor elsewhere; over the ramp itself the arrow stays; `panels::gradient` test `the_strip_under_the_ramp_shows_the_add_cursor` | | Blend spine Anchor Point conversion and handle editing (#2544) | implemented | symmetric handles, independent drag/retraction, visible-handle policy and selection/stacking covered by tool and engine regressions; Windows native canvas checks and screenshots reviewed in PR #2643 | | Several blend spine points picked and dragged together (#5285) | done | with Direct Selection, Shift-click picks more points of a selected blend's spine or takes one away, as on a path; dragging any picked point moves them all, and the key objects on them, in one undo step (`object.blend.spine.moveAnchor {with}`); a marquee picks the spine points inside it on the topmost selected blend, and with Shift adds or takes them away |