From e55ae75b95131e21b8dc663eaec9d780392281f7 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 17 Nov 2026 23:53:08 +0000 Subject: [PATCH] Dock drop spots: a settled region registers them again when it replays DockTargets notes each registration in the open run records, so a group or column that replays its last run keeps its drop spots, room and bands. --- crates/ui-contract/src/runtime/mod.rs | 3 ++- crates/ui-contract/src/runtime/replay.rs | 5 +++-- crates/ui-panels/src/docking/targets.rs | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/crates/ui-contract/src/runtime/mod.rs b/crates/ui-contract/src/runtime/mod.rs index 289aee744..4a9dae7f4 100644 --- a/crates/ui-contract/src/runtime/mod.rs +++ b/crates/ui-contract/src/runtime/mod.rs @@ -27,7 +27,8 @@ pub mod pen; pub mod pending; pub mod pointer; pub(crate) mod reads; -pub(crate) mod replay; +#[doc(hidden)] +pub mod replay; pub mod requests; pub mod sampler; pub mod toast; diff --git a/crates/ui-contract/src/runtime/replay.rs b/crates/ui-contract/src/runtime/replay.rs index 4efdfb047..f4a317b18 100644 --- a/crates/ui-contract/src/runtime/replay.rs +++ b/crates/ui-contract/src/runtime/replay.rs @@ -161,8 +161,9 @@ fn with_open(ctx: &Context, f: impl FnOnce(&mut Facts)) { } /// Notes, in the records open around the running code, the registration `make` builds: called again, it registers -/// what the running code registered. -pub(crate) fn journal(ctx: &Context, make: impl FnOnce() -> F) { +/// what the running code registered. A service outside this crate that keeps registrations per pass (a dock's drop +/// spots) notes each one here, so a settled region's replay makes it again. +pub fn journal(ctx: &Context, make: impl FnOnce() -> F) { if recording(ctx) { let entry: Entry = Arc::new(make()); pass_state::with::(ctx, |recorder| recorder.journal.push(entry)); diff --git a/crates/ui-panels/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs index 0cdbc3c1b..827e34347 100644 --- a/crates/ui-panels/src/docking/targets.rs +++ b/crates/ui-panels/src/docking/targets.rs @@ -403,7 +403,7 @@ impl

Default for Pass

{ } } -impl DockTargets

{ +impl DockTargets

{ /// Runs `f` on the registries of the running pass; `None` outside a pass. fn with_pass(ctx: &Context, f: impl FnOnce(&mut Pass

) -> R) -> Option { let facts = frame::running(ctx)?; @@ -435,6 +435,10 @@ impl DockTargets

{ if !crate::runtime::measure::effect(ctx, "dock::register_target") { return; } + Self::journal(ctx, || { + let spot = spot.clone(); + move |ctx: &Context| Self::register_in(ctx, dock, spot.clone(), hit, applies) + }); Self::with_dock(ctx, dock, |targets| targets.add(spot, hit, applies, hit)); } @@ -445,6 +449,10 @@ impl DockTargets

{ if !crate::runtime::measure::effect(ctx, "dock::register_target") { return; } + Self::journal(ctx, || { + let spot = spot.clone(); + move |ctx: &Context| Self::register_band(ctx, dock, spot.clone(), band, line, reach) + }); let near = line.expand(reach).intersect(band); Self::with_dock(ctx, dock, |targets| targets.add(spot, band, band, near)); } @@ -456,9 +464,16 @@ impl DockTargets

{ if !crate::runtime::measure::effect(ctx, "dock::register_room") { return; } + Self::journal(ctx, || move |ctx: &Context| Self::register_room(ctx, dock, room)); Self::with_dock(ctx, dock, |targets| targets.room = Some(room)); } + /// Notes a registration in the records of the settling regions around the running code, so a region that settles + /// registers its drop spots again when it replays its last run. + fn journal(ctx: &Context, make: impl FnOnce() -> F) { + crate::runtime::replay::journal(ctx, make); + } + /// Runs `f` on the registry of `dock` in the running pass, made empty the first time. fn with_dock(ctx: &Context, dock: Id, f: impl FnOnce(&mut DockTargets

)) { Self::with_pass(ctx, |pass| {