From 2d4da9a7a68ad5d3932f378247da2f5ba49d4826 Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 12 Nov 2026 01:49:30 +0000 Subject: [PATCH] AddBesideHandles: outline the hot side's ghost of what a click adds --- crates/draw/src/ui/add_beside/mod.rs | 28 +++++++++++++++++------ crates/draw/src/ui/add_beside/stories.rs | 28 +++++++++++++++++++---- crates/draw/tests/it/add_beside.rs | 29 ++++++++++++++++++++---- 3 files changed, 69 insertions(+), 16 deletions(-) diff --git a/crates/draw/src/ui/add_beside/mod.rs b/crates/draw/src/ui/add_beside/mod.rs index ce1818d21..34513faa3 100644 --- a/crates/draw/src/ui/add_beside/mod.rs +++ b/crates/draw/src/ui/add_beside/mod.rs @@ -110,7 +110,7 @@ pub struct AddBesideOutput { pub added: Option, /// Alt was held with the click: add with contents (an artboard's copy). A key press never asks for a copy. pub copy: bool, - /// The button under the pointer or focused (the tool draws its ghost). + /// The button under the pointer or focused: the one in the hot look, whose ghost shows. pub hovered: Option, } @@ -138,7 +138,8 @@ impl Outcome for AddBesideOutput { /// is set (a drag runs); one when its disc touches a [`clear_of`](Self::clear_of) rectangle (a size label, a /// toolbar) or leaves the canvas. /// - Pointer: the pointing hand; a click reports [`AddBesideOutput::added`], with Alt held also `copy`; the hot look -/// (the accent disc) on hover and focus. +/// (the accent disc) on hover and focus, with the hot side's [`ghosts`](Self::ghosts) rect outlined: what the click +/// would add. /// - Keyboard: the group is one Tab stop named by the label (the "Add a connected shape" word after /// [`connecting`](Self::connecting)); the arrows move the focus to the button that lies in their screen /// direction, Enter or Space adds; each button is a `Button` node ("Add above", ...). @@ -152,6 +153,9 @@ pub struct AddBesideHandles<'a> { /// Screen rectangles no button may cover. #[prop] clear_of: &'a [Rect], + /// What each side would add, in document units: the next board or shape, outlined while its button is hot. + #[prop] + ghosts: &'a [(AddSide, DocRect)], /// Hides every button (while a drag runs). #[prop(flag)] hidden: bool, @@ -171,7 +175,8 @@ struct Report { impl<'a> AddBesideHandles<'a> { /// The buttons around `object`, in document units, the group named `label`. pub fn new(label: impl Into