Viewer: dock the magnifier, fixed zoom levels, Shift-driven with a frame
Build Packages / Unit tests (push) Successful in 1h11m40s
Build Packages / build:windows:nocuda (push) Successful in 17m39s
Build Packages / build:windows:cuda (push) Successful in 20m10s
Build Packages / build:viewer-tgz:cpu (push) Successful in 10m2s
Build Packages / build:viewer-tgz:cuda (push) Successful in 11m28s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 9m4s
Build Packages / build:rugnux:windows (push) Successful in 11m20s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 7m46s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 16m15s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 16m21s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 18m1s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 19m19s
Build Packages / build:rpm (rocky8) (push) Successful in 18m17s
Build Packages / build:rpm (rocky9) (push) Successful in 18m48s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 15m59s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 16m19s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m2s
Build Packages / Generate python client (push) Successful in 1m3s
Build Packages / Build documentation (push) Successful in 1m28s
Build Packages / Create release (push) Successful in 18s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 10m50s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 11m15s
Build Packages / Unit tests (push) Successful in 1h11m40s
Build Packages / build:windows:nocuda (push) Successful in 17m39s
Build Packages / build:windows:cuda (push) Successful in 20m10s
Build Packages / build:viewer-tgz:cpu (push) Successful in 10m2s
Build Packages / build:viewer-tgz:cuda (push) Successful in 11m28s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 9m4s
Build Packages / build:rugnux:windows (push) Successful in 11m20s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 7m46s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 16m15s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 16m21s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 18m1s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 19m19s
Build Packages / build:rpm (rocky8) (push) Successful in 18m17s
Build Packages / build:rpm (rocky9) (push) Successful in 18m48s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 15m59s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 16m19s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m2s
Build Packages / Generate python client (push) Successful in 1m3s
Build Packages / Build documentation (push) Successful in 1m28s
Build Packages / Create release (push) Successful in 18s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 10m50s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 11m15s
The magnifier moves from a helper window into its own dock below the inspector. It has three fixed zoom levels (x64 and x32 with the pixel values written on the pixels, x10 without) instead of wheel zoom, and follows the cursor only while Shift is held over the diffraction image. Meanwhile the diffraction view draws a frame around the area it covers, just outside that area so it stays visible at low zoom without hiding the pixels; releasing Shift (seen by the application-wide key filter, so wherever the focus is), moving without it or leaving the image hides it. A "Pop out" button moves the magnifier into a separate window and back. Qt's own dock floating stays disabled: a floated dock is placed off-screen on WSLg. Whether it was popped out, and the window geometry, persist across sessions. The inspector's image statistics become a collapsible section so a small screen can give the space to the magnifier. kLayoutVersion is bumped for the new dock. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4fd8167a5c
commit
d397717ff7
17 files changed
+267
-113
No files matched your search
@@ -79,7 +79,14 @@ void JFJochDiffractionImage::azimuthalHandles(const ROIAzimuthal &az, const Diff
|
||||
phimax = pt(d_mid, phi1);
|
||||
}
|
||||
|
||||
void JFJochDiffractionImage::mouseHover(const QPointF &coord, Qt::KeyboardModifiers) {
|
||||
void JFJochDiffractionImage::mouseHover(const QPointF &coord, Qt::KeyboardModifiers modifiers) {
|
||||
// Shift + a button is ROI drawing, not magnifying
|
||||
if ((modifiers & Qt::ShiftModifier) && mouse_event_type == MouseEventType::None) {
|
||||
emit magnifierMoved(coord);
|
||||
SetMagnifierFrame(QRectF(coord - QPointF(magnifier_field_.width(), magnifier_field_.height()) / 2,
|
||||
magnifier_field_));
|
||||
} else
|
||||
SetMagnifierFrame(QRectF());
|
||||
|
||||
if (image && (coord.x() >= 0)
|
||||
&& (coord.x() < image->Dataset().experiment.GetXPixelsNum())
|
||||
@@ -1144,6 +1151,17 @@ QString JFJochDiffractionImage::PixelLabel(int x, int y) const {
|
||||
void JFJochDiffractionImage::drawForeground(QPainter *painter, const QRectF &rect) {
|
||||
JFJochImage::drawForeground(painter, rect);
|
||||
|
||||
if (!magnifier_frame_.isEmpty()) {
|
||||
// In viewport pixels, just outside the covered area: at low zoom the area is only a few
|
||||
// screen pixels, and a line over it would hide exactly what the frame points at.
|
||||
painter->save();
|
||||
painter->resetTransform();
|
||||
painter->setPen(QPen(feature_color, 2, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawRect(QRectF(mapFromScene(magnifier_frame_).boundingRect()).adjusted(-1.5, -1.5, 1.5, 1.5));
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
const QString label = HoverResolutionLabel();
|
||||
if (label.isEmpty())
|
||||
return;
|
||||
@@ -1156,6 +1174,28 @@ void JFJochDiffractionImage::drawForeground(QPainter *painter, const QRectF &rec
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void JFJochDiffractionImage::setMagnifierField(QSizeF size) {
|
||||
magnifier_field_ = size;
|
||||
}
|
||||
|
||||
void JFJochDiffractionImage::hideMagnifierFrame() {
|
||||
SetMagnifierFrame(QRectF());
|
||||
}
|
||||
|
||||
void JFJochDiffractionImage::SetMagnifierFrame(const QRectF &r) {
|
||||
// Repaint only the outlines, old and new: the frame can cover much of a zoomed-in view
|
||||
QRegion dirty;
|
||||
for (const QRectF &f : {magnifier_frame_, r}) {
|
||||
if (f.isEmpty())
|
||||
continue;
|
||||
const QRect v = mapFromScene(f).boundingRect();
|
||||
dirty += QRegion(v.adjusted(-4, -4, 4, 4)).subtracted(QRegion(v.adjusted(2, 2, -2, -2)));
|
||||
}
|
||||
magnifier_frame_ = r;
|
||||
if (!dirty.isEmpty())
|
||||
viewport()->update(dirty);
|
||||
}
|
||||
|
||||
void JFJochDiffractionImage::scrollContentsBy(int dx, int dy) {
|
||||
JFJochImage::scrollContentsBy(dx, dy);
|
||||
if (hover_text_rect_.isEmpty())
|
||||
@@ -1191,5 +1231,6 @@ void JFJochDiffractionImage::leaveEvent(QEvent *event) {
|
||||
hover_resolution = NAN;
|
||||
DrawResolutionText();
|
||||
}
|
||||
SetMagnifierFrame(QRectF());
|
||||
JFJochImage::leaveEvent(event);
|
||||
}
|
||||
Reference in new issue
Block a user