Skip to content

Fix blank or slow thumbnails when dragging the image list scrollbar - #48

Merged
nooogle merged 2 commits into
masterfrom
fix/blank-or-slow-thumbnails
Oct 13, 2026
Merged

nooogle merged 2 commits into
masterfrom
fix/blank-or-slow-thumbnails

Conversation

@nooogle

@nooogle nooogle commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Problem

  • Dragging the scrollbar thumb in ImageListPanel kicked off thumbnail loads for every intermediate position, making loading slow.
  • Shrinking a virtual list that was scrolled far down left the native ListView with an out-of-range viewport (blank rows, TopItem null) that a later EnsureVisible(0) did not repair.

Fix

  • New internal ScrollAwareListView reports thumb drag start and scroll end via WM_VSCROLL.
  • ImageListPanel cancels in-flight loads when a drag starts and resumes loading on release.
  • The list scrolls back to the top while the old items still exist, before it is cleared.

Testing

  • dotnet build clean, 0 warnings.
  • UnitTests pass on net10.0-windows (192/192). No new tests: the change is native scroll-message handling.

🤖 Generated with Claude Code

Replace ListView with ScrollAwareListView to detect thumb dragging, pause and cancel image loading during drag, resume on scroll end, and reset the virtual list to the top before refresh to avoid blank or out-of-range viewports.
Copilot AI balanced review requested due to automatic review settings October 13, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Canceled and replacement loads can race and corrupt the active loading-range state.

2 open findings
What changed in this PR

Adds scroll-aware thumbnail loading to keep ImageListPanel responsive and prevent blank virtual-list viewports.

Changes:

  • Detects scrollbar thumb-drag lifecycle through WM_VSCROLL.
  • Cancels and resumes thumbnail loading around drag operations.
  • Resets the viewport before clearing virtual-list items.
File Description
ScrollAwareListView.cs Adds vertical scrollbar message handling.
ImageListPanel.Designer.cs Wires the specialized list view and events.
ImageListPanel.cs Coordinates viewport reset and deferred loading.
Files not reviewed (1)
  • CDS.ImageDisplay.WinForms/ImageBrowsing/ImageListPanel.Designer.cs: Generated file

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +643 to +646
_debounceTimer.Stop();
_cts?.Cancel();
_loadingStart = -1;
_loadingEnd = -1;
public event EventHandler? ScrollEnded;

/// <inheritdoc/>
protected override void WndProc(ref Message m)
…hine

A cancelled LoadRangeAsync could clear the loading markers of a replacement
load over the same range, because ownership was matched on the range. Match
on a per-load generation instead.

Add ScrollAwareListView tests covering the WM_VSCROLL thumb-drag state
machine.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nooogle
nooogle merged commit b9b1c4f into master Oct 13, 2026
5 checks passed
@nooogle
nooogle deleted the fix/blank-or-slow-thumbnails branch October 13, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants