Viewer: Alt and the wheel step through the images
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 8m57s
Build Packages / build:windows:nocuda (push) Successful in 17m15s
Build Packages / build:windows:cuda (push) Successful in 19m35s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 19m39s
Build Packages / build:viewer-tgz:cpu (push) Successful in 20m38s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 22m45s
Build Packages / build:viewer-tgz:cuda (push) Successful in 22m54s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 27m16s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 27m19s
Build Packages / build:rugnux:windows (push) Successful in 11m1s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 19m22s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 21m33s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 26m50s
Build Packages / build:rpm (rocky9) (push) Successful in 24m20s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 22m45s
Build Packages / Generate python client (push) Successful in 40s
Build Packages / build:rpm (rocky8) (push) Successful in 29m1s
Build Packages / Create release (push) Skipped
Build Packages / Build documentation (push) Successful in 1m4s
Build Packages / XDS test (durin plugin) (push) Successful in 11m2s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 27m23s
Build Packages / DIALS test (push) Successful in 26m51s
Build Packages / XDS test (neggia plugin) (push) Successful in 8m44s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 9m37s
Build Packages / Unit tests (push) Successful in 1h25m14s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 8m57s
Build Packages / build:windows:nocuda (push) Successful in 17m15s
Build Packages / build:windows:cuda (push) Successful in 19m35s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 19m39s
Build Packages / build:viewer-tgz:cpu (push) Successful in 20m38s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 22m45s
Build Packages / build:viewer-tgz:cuda (push) Successful in 22m54s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 27m16s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 27m19s
Build Packages / build:rugnux:windows (push) Successful in 11m1s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 19m22s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 21m33s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 26m50s
Build Packages / build:rpm (rocky9) (push) Successful in 24m20s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 22m45s
Build Packages / Generate python client (push) Successful in 40s
Build Packages / build:rpm (rocky8) (push) Successful in 29m1s
Build Packages / Create release (push) Skipped
Build Packages / Build documentation (push) Successful in 1m4s
Build Packages / XDS test (durin plugin) (push) Successful in 11m2s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 27m23s
Build Packages / DIALS test (push) Successful in 26m51s
Build Packages / XDS test (neggia plugin) (push) Successful in 8m44s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 9m37s
Build Packages / Unit tests (push) Successful in 1h25m14s
The wheel already zooms, and with Ctrl or Shift it moves the foreground; Alt now moves through the dataset, one image per notch, wheel up forward - the direction QAbstractSlider's own wheel handling uses, which is what the toolbar's scrub slider follows. The view does not know which image it is showing, so it emits the step and the navigation toolbar applies it: the same loadImage() every other control ends in, with the same clamp and the same Sum setting, so nothing about loading is duplicated. An empty dataset is left alone, because loadImage(-1) does not mean "before the first image" but "the latest one" when the viewer is following a running collection over HTTP. The signal is on JFJochImage, so the other views emit it too; only the diffraction view is connected, which leaves them as they were. Note for a desktop where Alt+wheel does nothing: many window managers grab Alt-modified mouse events before the application sees them, and that is a window-manager setting, not something the viewer can take back. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FBumeJVx4oeXxiBRpkrE5H
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
## 1.0.0
|
||||
### 1.0.0-rc.166
|
||||
* In `jfjoch_viewer`, Alt and the mouse wheel step through the dataset one image at a time.
|
||||
|
||||
### 1.0.0-rc.165
|
||||
This is an UNSTABLE release. It includes many experimental features, as well as many AI generated fixes. We recommend using rc.152 for production use.
|
||||
|
||||
|
||||
@@ -224,6 +224,8 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString
|
||||
|
||||
connect(toolBarImage, &JFJochViewerToolbarImage::loadImage, reading_worker, &JFJochImageReadingWorker::LoadImage);
|
||||
|
||||
connect(viewer, &JFJochDiffractionImage::stepImage, toolBarImage, &JFJochViewerToolbarImage::stepImage);
|
||||
|
||||
connect(toolBarDisplay, &JFJochViewerToolbarDisplay::setForeground, viewer,
|
||||
&JFJochDiffractionImage::changeForeground);
|
||||
|
||||
|
||||
@@ -143,6 +143,16 @@ void JFJochImage::setFeatureColor(QColor input) {
|
||||
void JFJochImage::wheelEvent(QWheelEvent *event) {
|
||||
if (!scene()) return;
|
||||
|
||||
// Alt+wheel steps through the dataset instead of zooming. The view does not know which image
|
||||
// it shows, so the step is emitted and the navigation toolbar applies it.
|
||||
if (event->modifiers() & Qt::AltModifier) {
|
||||
const int delta = event->angleDelta().y();
|
||||
if (delta != 0)
|
||||
emit stepImage(delta > 0 ? 1 : -1);
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
const double zoomFactor = 1.15; // Zoom factor
|
||||
|
||||
// Get the position of the mouse in scene coordinates
|
||||
|
||||
@@ -230,6 +230,8 @@ signals:
|
||||
void hoverScenePos(QPointF scenePos);
|
||||
// A new frame has been rendered into Frame(). Follower views repaint on this.
|
||||
void frameRendered();
|
||||
// Alt+wheel asks for a move through the dataset: +1 one image forward, -1 one back.
|
||||
void stepImage(int steps);
|
||||
private slots:
|
||||
void onScroll(int value);
|
||||
public slots:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "JFJochViewerToolbarImage.h"
|
||||
#include <algorithm>
|
||||
#include <QTimer>
|
||||
#include "../widgets/ToolbarIcons.h"
|
||||
|
||||
@@ -176,6 +177,15 @@ void JFJochViewerToolbarImage::leftmostButtonPressed() {
|
||||
emit loadImage(0, sum);
|
||||
}
|
||||
|
||||
void JFJochViewerToolbarImage::stepImage(int steps) {
|
||||
if (image_count_in_dataset == 0)
|
||||
return;
|
||||
const auto target = std::clamp<int64_t>(curr_image + steps, 0,
|
||||
static_cast<int64_t>(image_count_in_dataset) - 1);
|
||||
if (target != curr_image)
|
||||
emit loadImage(target, sum);
|
||||
}
|
||||
|
||||
void JFJochViewerToolbarImage::imageNumberSliderPressed() {
|
||||
image_number_slider_manual = true;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
explicit JFJochViewerToolbarImage(QWidget *parent = nullptr);
|
||||
public slots:
|
||||
void setImageNumber(int64_t total_images, int64_t current_image);
|
||||
void stepImage(int steps);
|
||||
void setAutoloadMode(JFJochImageReadingWorker::AutoloadMode input);
|
||||
void setHttpConnection(bool connected, QString addr);
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user