From 4255b79dc67f0d8e1d21e36be865910c0033028a Mon Sep 17 00:00:00 2001 From: kenmcgaugh Date: Tue, 10 Mar 2026 10:08:53 +1300 Subject: [PATCH] Fix mouse wheel zoom with high DPI Using the mouse wheel to zoom in the viewport while on a high DPI device was zooming around the wrong anchor position. Other mouse events were using different logic to for the mouse position so I updated the wheel event processing to do the same. Signed-off-by: kenmcgaugh --- src/ui/qml/viewport/src/qml_viewport.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/qml/viewport/src/qml_viewport.cpp b/src/ui/qml/viewport/src/qml_viewport.cpp index 6443eb052..731e733df 100644 --- a/src/ui/qml/viewport/src/qml_viewport.cpp +++ b/src/ui/qml/viewport/src/qml_viewport.cpp @@ -518,10 +518,10 @@ void QMLViewport::wheelEvent(QWheelEvent *event) { PointerEvent ev( EventType::MouseWheel, static_cast((int)event->buttons()), - event->position().x(), - event->position().y(), - width(), // FIXME should be width, but this function appears to never be called. - height(), // FIXME should be height + int(round(float(event->position().x()) * window()->effectiveDevicePixelRatio())), + int(round(float(event->position().y()) * window()->effectiveDevicePixelRatio())), + int(round(float(width()) * window()->effectiveDevicePixelRatio())), + int(round(float(height()) * window()->effectiveDevicePixelRatio())), qtModifierToOurs(event->modifiers()), renderer_actor ? renderer_actor->std_name() : "", std::make_pair(event->angleDelta().rx(), event->angleDelta().ry()),