viewer: don't rebuild the overlay while panning
Build Packages / build:viewer-tgz:cpu (push) Successful in 7m27s
Build Packages / build:viewer-tgz:cuda (push) Successful in 8m31s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 13m22s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 13m44s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 14m0s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 14m12s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 14m16s
Build Packages / build:rpm (rocky8) (push) Successful in 11m51s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 13m17s
Build Packages / XDS test (durin plugin) (push) Successful in 8m30s
Build Packages / Generate python client (push) Successful in 30s
Build Packages / Build documentation (push) Successful in 1m5s
Build Packages / Create release (push) Skipped
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m31s
Build Packages / build:rpm (rocky9) (push) Successful in 13m7s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 12m55s
Build Packages / DIALS test (push) Successful in 13m57s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m57s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 8m38s
Build Packages / Unit tests (push) Successful in 1h2m12s
Build Packages / build:windows:nocuda (push) Canceled after 0s
Build Packages / build:windows:cuda (push) Canceled after 0s

Overlay items live in scene coordinates, so QGraphicsView translates them
natively as the view scrolls - no rebuild is required to keep them in the
right place during a pan. Rebuilding on every scroll signal only re-ran the
spot/prediction viewport culling, at the cost of tearing down and recreating
every overlay item on each mouse-move step. Over remote X forwarding that
per-step rebuild (and the rasterised pixels it dirties) is the dominant
source of pan lag.

Skip the rebuild while a pan drag is in progress: onScroll() returns early
during a Panning gesture and the pan branch of mouseMoveEvent no longer
schedules one. The overlay is refreshed once when the pan ends, via the
existing mouseReleaseEvent -> updateROI() -> updateOverlay() path, which
re-runs culling for the revealed viewport. Trade-off: spots/predictions in
newly revealed regions appear on release rather than mid-drag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-23 11:04:14 +02:00
co-authored by Claude Opus 4.8
parent 54b1699d1f
commit cc850f181d
+12 -1
View File
@@ -43,6 +43,15 @@ JFJochImage::JFJochImage(QWidget *parent) : QGraphicsView(parent) {
}
void JFJochImage::onScroll(int value) {
// While the user drags a pan, the scene scrolls natively and overlay items
// (which live in scene coordinates) move with it - no rebuild is needed. A
// single pan step emits up to two scrollbar valueChanged signals; rebuilding
// the overlay on each would tear down and recreate every item for no visual
// change - the dominant lag over remote X. The overlay is refreshed once
// when the pan ends (mouseReleaseEvent -> updateROI -> updateOverlay), which
// re-runs spot/prediction culling for the newly revealed viewport.
if (mouse_event_type == MouseEventType::Panning)
return;
scheduleOverlayUpdate();
}
@@ -221,7 +230,9 @@ void JFJochImage::mouseMoveEvent(QMouseEvent *event) {
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - viewDelta.x());
verticalScrollBar()->setValue(verticalScrollBar()->value() - viewDelta.y());
scheduleOverlayUpdate();
// No overlay rebuild while dragging: the scene scrolls natively and
// items move with it. onScroll() skips rebuilds during a pan and the
// overlay is refreshed once on mouse release.
emitViewportChanged();
break;
}