Make the 3D mouse pan and zoom the element editor too

The 3D mouse only acted on the diagram editor: SpaceMouseListener
ignored every other window, so the element editor did not move at
all (reported by scorpio810 in PR #635 with a SpacePilot Pro).

applyMotion() now also handles a QETElementEditor, driving its
ElementView through the same scrollbar pan and a new
ElementView::zoom(factor), which keeps the wheel zoom's clamping.
The element editor's scene rect only covers what is on screen, so it
is grown before each pan sample, as its middle-button pan does;
without that the scrollbars have no range and the pan does nothing.

Verified under Xvfb with an LD_PRELOAD stand-in for libspnav feeding
recorded motion samples: element editor zooms 1.63x for ten z=50
samples and pans; diagram editor screenshots are byte-identical to
master's for the same input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-09-25 09:32:10 +12:00
parent 73075a5154
commit 04e2279a7f
4 changed files with 73 additions and 32 deletions
+12
View File
@@ -117,6 +117,18 @@ void ElementView::scaleClamped(qreal factor)
scale(factor, factor);
}
/**
@brief ElementView::zoom
Zoom by an arbitrary factor, for a continuous input such as a 3D mouse.
Same clamping as the wheel zoom.
@param zoom_factor : > 1 zooms in, < 1 zooms out
*/
void ElementView::zoom(qreal zoom_factor)
{
adjustSceneRect();
scaleClamped(zoom_factor);
}
/**
Agrandit le schema (+33% = inverse des -25 % de zoomMoins())
*/