From 23934cdd6f39cab15cf3f78fddec4ecde3e0c24c Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 11 Nov 2026 23:29:55 +0000 Subject: [PATCH] Collection response reports the drop a release would make: PendingDrop (own reorder, items from another collection, OS files) while the collection's target wins; LayersPanel previews it as drop_preview, PageThumbnails reports drop_target and file_gap --- crates/layers/src/ui/panel/body.rs | 19 ++++- crates/layers/src/ui/panel/mod.rs | 10 ++- crates/pages/src/ui/thumbnails.rs | 14 +++- crates/ui-contract/src/contract/collection.rs | 3 +- .../src/contract/collection/response.rs | 43 +++++++++- crates/ui-contract/src/contract/items/drag.rs | 82 +++++++++++-------- .../ui-contract/src/contract/items/hooks.rs | 11 ++- .../ui-contract/src/contract/items/output.rs | 4 +- crates/ui-contract/src/contract/mod.rs | 4 +- .../tests/it/collection/reorder_groups.rs | 29 ++++++- 10 files changed, 165 insertions(+), 54 deletions(-) diff --git a/crates/layers/src/ui/panel/body.rs b/crates/layers/src/ui/panel/body.rs index afad509ff..7efceef46 100644 --- a/crates/layers/src/ui/panel/body.rs +++ b/crates/layers/src/ui/panel/body.rs @@ -10,15 +10,17 @@ pub(in crate::ui::panel) use rows::{LayerRows, ToggleSweeps, reveal_plan}; use rows::{RevealPlan, list_selection}; use craft_behavior::{ColumnWidth, IconId}; -use craft_ui::contract::{Bind, CollectionEvent, ColumnKind, ColumnSpec, ListDrag, Props as _, ReorderRule, ShowCollection as _, ToggleColumn}; +use craft_ui::contract::{ + Bind, CollectionEvent, ColumnKind, ColumnSpec, ListDrag, PendingDrop, Props as _, ReorderRule, ShowCollection as _, ToggleColumn, +}; use craft_ui::list::List; use craft_ui::runtime::env::Label; use egui::Ui; use super::Session; use super::context::PanelContext; -use super::drag::{LayersDrag, accepts_drop}; -use super::events::LayersEvent; +use super::drag::{LayersDrag, accepts_drop, layer_drop}; +use super::events::{LayerDrop, LayerMove, LayersEvent}; use super::row::{EYE, LOCK, NAME, build_row}; use crate::ui::tree::{LayerRowKey, LayerTree}; @@ -26,6 +28,8 @@ use crate::ui::tree::{LayerRowKey, LayerTree}; pub(super) struct BodyOutput { pub(super) events: Vec>, pub(super) response: egui::Response, + /// The layer move a release of the held rows would make, while the option to preview it is on. + pub(super) drop_preview: Option>, } /// Shows the list over `rows` and maps what it reports. @@ -84,6 +88,13 @@ pub(super) fn show_body( }); let mut events: Vec> = reveal.opens.iter().cloned().map(LayersEvent::Open).collect(); + let drop_preview = match &out.pending_drop { + Some(PendingDrop::Reorder(mv)) if cx.options.preview_on_canvas_when_reordering => match layer_drop(mv, &order, &parent_of, filtered) { + Some(LayerDrop::Layers(layers)) => Some(layers), + _ => None, + }, + _ => None, + }; let selection_changed = out.events.iter().any(|event| matches!(event, CollectionEvent::Selection(_))); let list_events = out.events; map_events(cx, &order, &parent_of, filtered, lock_name, session, list_events, &mut events); @@ -97,5 +108,5 @@ pub(super) fn show_body( session.anchor = selection.anchor.as_ref().map(|key| LayerRowKey::Layer(key.layer().clone())); session.produced = layers; } - BodyOutput { events, response: out.response } + BodyOutput { events, response: out.response, drop_preview } } diff --git a/crates/layers/src/ui/panel/mod.rs b/crates/layers/src/ui/panel/mod.rs index 0af3bee10..298958158 100644 --- a/crates/layers/src/ui/panel/mod.rs +++ b/crates/layers/src/ui/panel/mod.rs @@ -171,6 +171,9 @@ pub struct LayersPanel<'a, T: LayerTree> { pub struct LayersOutput { /// What the user did this pass, in order. pub events: Vec>, + /// While rows are dragged and Preview on Canvas When Reordering Layers is on, the layer move the release would + /// make, for the app's canvas preview; `None` otherwise. + pub drop_preview: Option>, /// The panel. pub response: Response, } @@ -349,11 +352,12 @@ impl<'a, T: LayerTree> LayersPanel<'a, T> { while let Some((key, _)) = stack.take_command::() { reported.extend(key.event(tree)); } - reported + (reported, body.drop_preview) }); // Only the real run's result comes back, so the reveal's opens and the list's events are reported once. let mut events = events.into_inner(); - events.extend(shown.inner.unwrap_or_default()); - LayersOutput { events, response: shown.output } + let (body, drop_preview) = shown.inner.unwrap_or_default(); + events.extend(body); + LayersOutput { events, drop_preview, response: shown.output } } } diff --git a/crates/pages/src/ui/thumbnails.rs b/crates/pages/src/ui/thumbnails.rs index 50af5f5e4..efaef58d4 100644 --- a/crates/pages/src/ui/thumbnails.rs +++ b/crates/pages/src/ui/thumbnails.rs @@ -27,7 +27,7 @@ use super::view::PageSource; use craft_behavior::{EditEvent, IconId, Selection, SelectionChange, keyed}; use craft_ui::buttons::Button; use craft_ui::contract::{ - Bind, CollectionEvent, ContextMenuRequest, NoValue, Outcome, ReorderMove, ReorderRule, Show as _, ShowCollection as _, clicked, + Bind, CollectionEvent, ContextMenuRequest, NoValue, Outcome, PendingDrop, ReorderMove, ReorderRule, Show as _, ShowCollection as _, clicked, }; use craft_ui::list::ThumbAspect; use craft_ui::primitives::textures::{Priority, ThumbPaint, ThumbRequest, ThumbnailOptions, Thumbnails}; @@ -156,6 +156,11 @@ pub struct PageThumbnailsOutput { pub response: Response, /// What happened this pass, in order. pub events: Vec, + /// While pages are dragged, the move their release would make. + pub drop_target: Option>, + /// While files from the OS are held over the grid, the page they would land before (the page count after the + /// last). + pub file_gap: Option, } impl Outcome for PageThumbnailsOutput { @@ -331,6 +336,11 @@ impl<'a> PageThumbnails<'a> { _ => {} } } + let (drop_target, file_gap) = match shown.response.pending_drop { + Some(PendingDrop::Reorder(mv)) => (Some(mv), None), + Some(PendingDrop::Files { insert }) => (None, Some(insert)), + _ => (None, None), + }; for event in shown.response.events { match event { CollectionEvent::Selection(change) => events.push(ThumbnailEvent::Selection(change)), @@ -356,7 +366,7 @@ impl<'a> PageThumbnails<'a> { if new_page_row && clicked(&Button::new(words.new_page.clone()).show(ui)) { events.push(ThumbnailEvent::NewPage); } - PageThumbnailsOutput { response: shown.response.response, events } + PageThumbnailsOutput { response: shown.response.response, events, drop_target, file_gap } } } diff --git a/crates/ui-contract/src/contract/collection.rs b/crates/ui-contract/src/contract/collection.rs index 3f1c25bcb..3404fc164 100644 --- a/crates/ui-contract/src/contract/collection.rs +++ b/crates/ui-contract/src/contract/collection.rs @@ -11,4 +11,5 @@ pub use props::{ ActivateOn, CollectionProps, DragPayload, ItemKeys, LeadOnOpen, LeadSource, ReorderRule, RowPressed, RowState, SelectMode, SpaceAction, }; pub(crate) use response::Gestures; -pub use response::{CollectionResponse, ShownRow}; +pub(crate) use response::ItemsOut; +pub use response::{CollectionResponse, PendingDrop, ShownRow}; diff --git a/crates/ui-contract/src/contract/collection/response.rs b/crates/ui-contract/src/contract/collection/response.rs index 0012bd969..acf8d6ec9 100644 --- a/crates/ui-contract/src/contract/collection/response.rs +++ b/crates/ui-contract/src/contract/collection/response.rs @@ -1,6 +1,6 @@ //! A collection's output: `CollectionResponse`, the rows it showed and the gestures it allows. -use super::events::CollectionEvent; +use super::events::{CollectionEvent, ReorderMove}; use super::props::{CollectionProps, SelectMode}; use craft_behavior::ColumnKey; use egui::Response; @@ -27,12 +27,36 @@ pub struct CollectionResponse { /// The click count of the press behind this pass's `Activate`: 2 for the second click of a double click, 0 when a /// key or no pointer activated. pub activation_clicks: u8, + /// While a drag is over the collection, the drop its release would make; `None` when the collection would take + /// none. An app previews it (a layer move on the canvas); the drop itself comes as its event. + pub pending_drop: Option>, +} + +/// The drop a release would make on a collection now. +#[derive(Clone, Debug, PartialEq, Eq)] +#[non_exhaustive] +pub enum PendingDrop { + /// The collection's own items move: the move `CollectionEvent::Reorder` would carry. + Reorder(ReorderMove), + /// Items dragged from another collection land before `insert`, over `key` (none over an empty collection), as + /// `CollectionEvent::Dropped` would report. + Items { + /// The item under the pointer. + key: Option, + /// The position of the display order the items land before. + insert: usize, + }, + /// Files from the OS land before `insert`, as `CollectionEvent::FilesDropped` would report. + Files { + /// The position of the display order the files land before. + insert: usize, + }, } impl CollectionResponse { pub(crate) fn new( response: Response, - (events, shown, activation_clicks): (Vec>, Vec>, u8), + ItemsOut { events, shown, activation_clicks, pending_drop }: ItemsOut, visible: Range, gestures: Gestures, ) -> Self { @@ -45,6 +69,7 @@ impl CollectionResponse { rename: gestures.rename, reorder: gestures.reorder, activation_clicks, + pending_drop, } } @@ -55,6 +80,20 @@ impl CollectionResponse { } } +/// What the item step hands to `collection_response`. +pub(crate) struct ItemsOut { + pub(crate) events: Vec>, + pub(crate) shown: Vec>, + pub(crate) activation_clicks: u8, + pub(crate) pending_drop: Option>, +} + +impl Default for ItemsOut { + fn default() -> Self { + ItemsOut { events: Vec::new(), shown: Vec::new(), activation_clicks: 0, pending_drop: None } + } +} + /// The geometry of one row the collection showed this pass. #[derive(Clone, Debug)] #[non_exhaustive] diff --git a/crates/ui-contract/src/contract/items/drag.rs b/crates/ui-contract/src/contract/items/drag.rs index e97ffd581..837c97287 100644 --- a/crates/ui-contract/src/contract/items/drag.rs +++ b/crates/ui-contract/src/contract/items/drag.rs @@ -9,9 +9,10 @@ use super::ItemsHooks; use super::marquee::MarqueeDrag; -use crate::contract::collection::{CollectionEvent, CollectionProps, ColumnKind, ListDrag, ReorderMove, ToggleColumn, ToggleEdit}; +use crate::contract::collection::{CollectionEvent, CollectionProps, ColumnKind, ListDrag, PendingDrop, ReorderMove, ToggleColumn, ToggleEdit}; use crate::contract::reorder; use crate::contract::{Collection, Cx, DragPreview, DropMark, DropTarget, OsFiles, Pointer as _}; +use crate::runtime::drag; use crate::runtime::env::Label; use craft_behavior::{ Axis, CancelReason, ColumnKey, DropOperation, EditEvent, Flow, GestureId, ItemLayout, Mixed, NavShape, Outline, PointerButton, PressCancel, @@ -149,8 +150,8 @@ pub(super) struct Drags { pub(super) grabbed: Option, sweep: Option>, moving: Option, - /// The row a drag from another collection would drop on this pass. - pub(super) over: Option, + /// The drop a release would make this pass. + pub(super) pending: Option>, /// The selected row a plain press landed on: a click on it narrows the selection to it, a drag keeps it. pub(super) collapse: Option, /// The row whose rename column got a double press: the editor opens when the press ends as a click, not when it @@ -180,7 +181,7 @@ pub(super) struct SlowClick { impl Default for Drags { fn default() -> Self { - Drags { grabbed: None, sweep: None, moving: None, over: None, collapse: None, rename: None, activate: None, marquee: None, slow: None } + Drags { grabbed: None, sweep: None, moving: None, pending: None, collapse: None, rename: None, activate: None, marquee: None, slow: None } } } @@ -427,34 +428,44 @@ impl ItemsHooks<'_, '_, C> { false } + /// The move a drop of the collection's own `payload` at `landed` makes, before and after; `None` when it would + /// leave every item where it is. + fn own_move(&self, payload: &ListDrag, landed: Landed, groups: bool) -> Option<(ReorderMove, ReorderMove)> { + // The moved items in display order, as they stand in the source now. + let at: Vec = + payload.keys.iter().filter_map(|key| self.index_of(key)).collect::>().into_iter().collect(); + let &from = at.first()?; + let to = reorder::move_all_to(&at, landed.spot.insert); + let copy = matches!(landed.op, DropOperation::Copy); + let together = at.iter().enumerate().all(|(n, &place)| place == from + n); + let parent = landed.spot.parent.map(|row| self.source.key(row)); + let held = if groups { reorder::parent_of(&Outline::new(self.source), from).map(|row| self.source.key(row)) } else { None }; + if to == from && together && !copy && parent == held { + return None; + } + let keys: Vec = at.iter().map(|&place| self.source.key(place)).collect(); + let key = payload.grabbed.clone(); + Some((ReorderMove::new(key.clone(), keys.clone(), from, false).in_group(held), ReorderMove::new(key, keys, to, copy).in_group(parent))) + } + + /// The drop `payload` makes at `landed`: a reorder of the collection's own items, or items from another one. + fn drop_of(&self, own: bool, payload: &ListDrag, landed: Landed, groups: bool) -> Option> { + if own { + return self.own_move(payload, landed, groups).map(|(_, after)| PendingDrop::Reorder(after)); + } + let key = (!self.source.is_empty()).then(|| self.source.key(landed.spot.over)); + Some(PendingDrop::Items { key, insert: landed.spot.insert }) + } + fn land(&mut self, cx: &mut Cx<'_, C>, payload: &ListDrag, landed: Landed, groups: bool) { if payload.list != cx.core.id { let key = (!self.source.is_empty()).then(|| self.source.key(landed.spot.over)); self.events.push(CollectionEvent::Dropped { key, insert: landed.spot.insert, op: landed.op, keys: payload.keys.clone() }); return; } - // The moved items in display order, as they stand in the source now. - let at: Vec = - payload.keys.iter().filter_map(|key| self.index_of(key)).collect::>().into_iter().collect(); - let Some(&from) = at.first() else { return }; - let insert = landed.spot.insert; - let to = reorder::move_all_to(&at, insert); - let copy = matches!(landed.op, DropOperation::Copy); - let together = at.iter().enumerate().all(|(n, &place)| place == from + n); - let parent = landed.spot.parent.map(|row| self.source.key(row)); - let held = if groups { reorder::parent_of(&Outline::new(self.source), from).map(|row| self.source.key(row)) } else { None }; - if to == from && together && !copy && parent == held { - return; + if let Some((before, after)) = self.own_move(payload, landed, groups) { + self.events.push(CollectionEvent::Reorder(EditEvent::set(Mixed::Same(before), after, cx.core.label_arc(), None))); } - let keys: Vec = at.iter().map(|&place| self.source.key(place)).collect(); - let key = payload.grabbed.clone(); - let before = ReorderMove::new(key.clone(), keys.clone(), from, false).in_group(held); - self.events.push(CollectionEvent::Reorder(EditEvent::set( - Mixed::Same(before), - ReorderMove::new(key, keys, to, copy).in_group(parent), - cx.core.label_arc(), - None, - ))); } /// Step 9: sweeps, row drags, drops and the free-layout move, from the collection's own press and the drag session. @@ -466,7 +477,7 @@ impl ItemsHooks<'_, '_, C> { (rect, offset, rtl): (Rect, ScrollPos, bool), props: &CollectionProps, ) { - self.drags.over = None; + self.drags.pending = None; let free = matches!(layout.nav(), NavShape::Spatial); let phase = cx.core.press.phase; // The pointer comes in screen space; the rows and a move's offset are in the rows' own space. @@ -519,15 +530,17 @@ impl ItemsHooks<'_, '_, C> { .filter(|spot| comp.accepts(&payload, Some(&self.source.key(spot.over)), spot.insert)) .filter(|spot| !(own && groups) || !self.inside_dragged(&payload, spot.parent)) }; - if let Some(spot) = spot - && !own - && !self.source.is_empty() - { - self.drags.over = Some(self.source.key(spot.over)); - } let copy_ok = !own || props.reorder.is_some_and(|rule| rule.copy_with_alt); + let ordinal = drag::next_ordinal(&cx.core.ctx, cx.core.id); if let Some(landed) = cx.drop_target::, _>(&RowDrop { spot, copy_ok }) { self.land(cx, &payload, landed, groups); + } else if let Some(spot) = spot + && drag::winning(&cx.core.ctx, cx.core.id, ordinal) + { + let op = drag::current_operation(&cx.core.ctx); + if copy_ok || !matches!(op, DropOperation::Copy) { + self.drags.pending = self.drop_of(own, &payload, Landed { spot, op }, groups); + } } } } else { @@ -538,8 +551,13 @@ impl ItemsHooks<'_, '_, C> { { let at = layer(at); let spot = if self.source.is_empty() { self.empty_spot(rect, at) } else { self.spot(layout, rect, offset, rtl, None, at) }; + let ordinal = drag::next_ordinal(&cx.core.ctx, cx.core.id); if let Some(spot) = cx.drop_target::(&FileDrop { spot }) { self.events.push(CollectionEvent::FilesDropped { insert: spot.insert, files: files.files.clone() }); + } else if let Some(spot) = spot + && drag::winning(&cx.core.ctx, cx.core.id, ordinal) + { + self.drags.pending = Some(PendingDrop::Files { insert: spot.insert }); } } } diff --git a/crates/ui-contract/src/contract/items/hooks.rs b/crates/ui-contract/src/contract/items/hooks.rs index 295fc7f81..d596abb6f 100644 --- a/crates/ui-contract/src/contract/items/hooks.rs +++ b/crates/ui-contract/src/contract/items/hooks.rs @@ -6,7 +6,7 @@ use super::members::Member; use super::{Held, ITEM_NODE, ItemsHooks, LastLayout, Lead, Placement, Renaming, Rows, SCROLL, Scrolled, View, key_hash, section_part}; use super::{request, rows}; use crate::contract::ValueOf; -use crate::contract::collection::{CollectionEvent, ContextMenuRequest, Gestures, OpenChange, Rename, RowState, ShownRow}; +use crate::contract::collection::{CollectionEvent, ContextMenuRequest, Gestures, ItemsOut, OpenChange, PendingDrop, Rename, RowState, ShownRow}; use crate::contract::cx::{BodyCx, Pointer as _}; use crate::contract::run::{Measuring, ShapeHooks, ShowAt}; use crate::contract::steps::ShapeKind; @@ -458,7 +458,7 @@ impl ShapeHooks for ItemsHooks<'_, '_, C> { run.is_multiple_of(2) && !self.source.is_section(at) }, dragging: self.drags.grabbed.as_ref() == Some(&key), - drop_target: self.drags.over.as_ref() == Some(&key), + drop_target: matches!(&self.drags.pending, Some(PendingDrop::Items { key: Some(over), .. }) if *over == key), current: current.as_ref() == Some(&key), open: self.source.has_children(at) && self.source.open(at), hovered: hover_at.is_some_and(|pos| row.contains(pos)), @@ -711,7 +711,12 @@ impl ShapeHooks for ItemsHooks<'_, '_, C> { self.header.report(&cx.core.ctx, id, cx); *cx.core.memory.session::>(sub(id, "rename")) = self.renaming.clone(); cx.core.collection_selection = Some(Box::new(self.selection.clone())); - cx.core.collection_events = Some(Box::new((std::mem::take(&mut self.events), std::mem::take(&mut self.shown), self.activation_clicks))); + cx.core.collection_events = Some(Box::new(ItemsOut { + events: std::mem::take(&mut self.events), + shown: std::mem::take(&mut self.shown), + activation_clicks: self.activation_clicks, + pending_drop: self.drags.pending.clone(), + })); cx.core.visible_rows = self.visible.clone(); cx.core.gestures = Gestures::of(comp.items()); } diff --git a/crates/ui-contract/src/contract/items/output.rs b/crates/ui-contract/src/contract/items/output.rs index b24b2bd53..1680bc416 100644 --- a/crates/ui-contract/src/contract/items/output.rs +++ b/crates/ui-contract/src/contract/items/output.rs @@ -1,6 +1,6 @@ //! What a collection's caller reads from `Cx` after the item step: its selection and response. -use crate::contract::collection::{CollectionEvent, CollectionResponse, ShownRow}; +use crate::contract::collection::{CollectionResponse, ItemsOut}; use crate::contract::{Collection, Cx}; impl Cx<'_, C> { @@ -17,7 +17,7 @@ impl Cx<'_, C> { .core .collection_events .take() - .and_then(|held| held.downcast::<(Vec>, Vec>, u8)>().ok()) + .and_then(|held| held.downcast::>().ok()) .map(|held| *held) .unwrap_or_default(); CollectionResponse::new(self.core.response.clone(), events, self.core.visible_rows.clone(), self.core.gestures) diff --git a/crates/ui-contract/src/contract/mod.rs b/crates/ui-contract/src/contract/mod.rs index 5b4409dc6..eb12ab7e2 100644 --- a/crates/ui-contract/src/contract/mod.rs +++ b/crates/ui-contract/src/contract/mod.rs @@ -49,8 +49,8 @@ pub use body::REORDER_BAND; pub use body::pad_of; pub use collection::{ ActivateOn, CollectionEvent, CollectionProps, CollectionResponse, ColumnAlign, ColumnEvent, ColumnKind, ColumnSort, ColumnSpec, - ContextMenuRequest, DragPayload, HeaderMenuRequest, ItemKeys, LeadOnOpen, LeadSource, ListDrag, OpenChange, Rename, ReorderMove, ReorderRule, - RowPressed, RowState, SelectMode, ShownRow, SpaceAction, ToggleColumn, ToggleEdit, + ContextMenuRequest, DragPayload, HeaderMenuRequest, ItemKeys, LeadOnOpen, LeadSource, ListDrag, OpenChange, PendingDrop, Rename, ReorderMove, + ReorderRule, RowPressed, RowState, SelectMode, ShownRow, SpaceAction, ToggleColumn, ToggleEdit, }; #[doc(hidden)] pub use container::InBar; diff --git a/crates/ui-contract/tests/it/collection/reorder_groups.rs b/crates/ui-contract/tests/it/collection/reorder_groups.rs index 3538627f0..46a11f1a3 100644 --- a/crates/ui-contract/tests/it/collection/reorder_groups.rs +++ b/crates/ui-contract/tests/it/collection/reorder_groups.rs @@ -1,8 +1,8 @@ -//! Reordering into the groups of a tree: where a drop lands below an open group, and that a group does not drop -//! inside itself. +//! Reordering into the groups of a tree: where a drop lands below an open group, that a group does not drop inside +//! itself, and the drop a release would make, reported while the drag is held. use super::kit::{Dismissed, List, ROW_H, Row, Words}; -use craft_ui::contract::{CollectionEvent, CollectionResponse, Props as _, SelectMode, ShowCollection as _}; +use craft_ui::contract::{CollectionEvent, CollectionResponse, PendingDrop, Props as _, SelectMode, ShowCollection as _}; use craft_ui::runtime::drag; use craft_ui::testing::layout::in_region; use craft_ui::testing::pointer::{moved, press, release}; @@ -28,6 +28,7 @@ fn grove() -> Words { struct Run { events: RefCell>>, rows: RefCell>, + pending: RefCell>>, } impl Run { @@ -37,6 +38,7 @@ impl Run { fn take(&self, out: CollectionResponse) { self.events.borrow_mut().extend(out.events); + *self.pending.borrow_mut() = out.pending_drop; } /// Every reorder reported: the moved keys, the position and the group. @@ -114,3 +116,24 @@ fn a_group_does_not_drop_inside_itself() { release_at(&mut frames, at, &mut show); assert!(run.moves().is_empty()); } + +/// While rows are held over the list, the response carries the move a release would make; the release reports that +/// move, and over no row there is none. +#[trial] +fn a_held_drag_reports_the_move_its_release_makes() { + let (words, run) = (grove(), Run::default()); + let mut frames = Frames::new(); + let mut show = |ui: &mut Ui| show_grove(ui, List::new(SelectMode::Single).tree().reorder_into_groups(), &words, &run); + frames.idle(3, &mut show); + let outside = ORIGIN + VIEW + Vec2::splat(20.0); + drag_to(&mut frames, &run, 0, outside, &mut show); + assert_eq!(*run.pending.borrow(), None, "outside the list a release drops nothing here"); + let at = point(&run, 4, SHALLOW, ROW_H * 0.75); + frames.frame(vec![moved(at)], &mut show); + frames.idle(1, &mut show); + let Some(PendingDrop::Reorder(pending)) = run.pending.borrow().clone() else { panic!("a held reorder: {:?}", run.pending.borrow()) }; + assert!(run.moves().is_empty(), "nothing moves before the release"); + release_at(&mut frames, at, &mut show); + assert_eq!(run.moves(), vec![(pending.keys, pending.to, pending.parent)]); + assert_eq!(*run.pending.borrow(), None, "after the drop nothing is pending"); +}