fix(ui): OP5 re-check residuals R1/R2 (coordinator pass) — OP5 CLOSED
R1: UiRoot now delivers WM_CAPTURECHANGED (0x215 — retail's own Win32 event-id space) to the element losing pointer capture on BOTH release and re-target; UiScrollbar terminates a mid-drag gesture there, completing it (one DragCompleted flush persisting the user's last-seen value) and unlatching IsDragging — a panel-close keybind mid-drag or a second-button re-target can no longer latch the drag flag forever and silently suppress every later settings flush. Normal MouseUp paths no-op (the latch is already clear when capture releases). R2: the scalar latch arms BEFORE the track-click jump applies, so the jump's own ScalarChanged tick defers its flush to the MouseUp's single DragCompleted — one flush per press gesture, never the inline-then-completed double; the DragCompleted doc now states the real contract (fires once per value-capable gesture incl. capture loss) instead of the refuted never-on-jump claim. Tests: capture-loss mid-drag (ends + completes once + stray-MouseUp no-double), no-drag capture-change no-op, bare-track-click single-completion with the latch observed armed during the jump tick. Also reconciles the research doc's U4 row to its closure (the six caption pairs, the BN zero-fold post-mortem) per the OP6 rework's flag. Full Release suite: 13,128 passed / 4 skipped / 0 failed (one documented #250-class allocation flake on first run, green in isolation and on full-suite rerun). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
472525b99e
commit
67b0815c79
5 changed files with 142 additions and 10 deletions
|
|
@ -44,14 +44,19 @@ public sealed class UiScrollbar : UiElement
|
|||
public bool IsDragging => _draggingThumb;
|
||||
|
||||
/// <summary>
|
||||
/// Fires once, at the <c>MouseUp</c> that ends a thumb drag — never on a
|
||||
/// <c>MouseUp</c> that was not preceded by an actual drag (a bare click that
|
||||
/// only page-scrolled or jumped, or a stray <c>MouseUp</c> with no prior
|
||||
/// <c>MouseDown</c>). OP5 review fix S1: the drag-end seam neither
|
||||
/// <see cref="ScalarChanged"/> (fires on every tick) nor <see cref="Model"/>
|
||||
/// scrolling provided — the Chat tab's opacity sliders use this to flush a
|
||||
/// batched settings write exactly once per drag gesture instead of once per
|
||||
/// <c>MouseMove</c>.
|
||||
/// Fires once at the end of a press gesture that could have changed the
|
||||
/// value: the <c>MouseUp</c> ending a MODEL-mode thumb drag, the
|
||||
/// <c>MouseUp</c> ending ANY scalar-mode press (thumb drag OR bare
|
||||
/// track-click jump — OP5 re-check R2: the scalar latch arms on
|
||||
/// <c>MouseDown</c> before the jump applies, so the jump's flush defers
|
||||
/// here rather than double-flushing), or a <c>WM_CAPTURECHANGED</c>
|
||||
/// capture loss mid-drag (OP5 re-check R1 — the gesture completes with
|
||||
/// the user's last-seen value). Never fires on a stray <c>MouseUp</c>
|
||||
/// with no prior press, nor on model-mode button/page clicks. OP5 review
|
||||
/// fix S1: the drag-end seam neither <see cref="ScalarChanged"/> (fires
|
||||
/// per tick) nor <see cref="Model"/> scrolling provided — the Chat tab's
|
||||
/// opacity sliders flush a batched settings write exactly once per
|
||||
/// gesture instead of once per <c>MouseMove</c>.
|
||||
/// </summary>
|
||||
public Action? DragCompleted { get; set; }
|
||||
|
||||
|
|
@ -372,6 +377,20 @@ public sealed class UiScrollbar : UiElement
|
|||
|
||||
public override bool OnEvent(in UiEvent e)
|
||||
{
|
||||
// OP5 re-check R1: a capture drop without a MouseUp (panel hidden by
|
||||
// a keybind mid-drag; a second button re-targeting capture) ends the
|
||||
// drag HERE — completing the gesture (flush via DragCompleted) so the
|
||||
// user's last-seen value persists and IsDragging cannot latch true
|
||||
// forever. A normal MouseUp already cleared the latch, so this no-ops.
|
||||
if (e.Type == UiEventType.CaptureChanged)
|
||||
{
|
||||
bool wasDragging = _draggingThumb;
|
||||
_draggingThumb = false;
|
||||
_pressedButton = EndButton.None;
|
||||
if (wasDragging) DragCompleted?.Invoke();
|
||||
return false; // informational — never consumes
|
||||
}
|
||||
|
||||
if (IsModelDisabled)
|
||||
{
|
||||
_draggingThumb = false;
|
||||
|
|
@ -532,6 +551,12 @@ public sealed class UiScrollbar : UiElement
|
|||
float travel = MathF.Max(1f, Width - thumbWidth);
|
||||
float thumbX = travel * ScalarPosition;
|
||||
float x = e.Data1;
|
||||
// OP5 re-check R2: the latch is set BEFORE the track-click
|
||||
// jump below, so the jump's own ScalarChanged tick reads
|
||||
// IsDragging=true and DEFERS its flush to the MouseUp's
|
||||
// DragCompleted — one flush per press gesture, never the
|
||||
// inline-then-DragCompleted double the previous order caused.
|
||||
_draggingThumb = true;
|
||||
if (x >= thumbX && x <= thumbX + thumbWidth)
|
||||
{
|
||||
_dragOffsetX = x - thumbX;
|
||||
|
|
@ -541,7 +566,6 @@ public sealed class UiScrollbar : UiElement
|
|||
_dragOffsetX = thumbWidth * 0.5f;
|
||||
ChangeScalarPosition((x - _dragOffsetX) / travel);
|
||||
}
|
||||
_draggingThumb = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue