Skip to content

Commit e1e3291

Browse files
authored
Fix for mouse wheel zooming on HiDPI displays. (#247)
Signed-off-by: Ken McGaugh <ken@mcgaugh.co.uk> Signed-off-by: Ken McGaugh <ken@wetafx.co.nz>
1 parent d68c9f4 commit e1e3291

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/ui/qml/viewport/src/qml_viewport.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,10 @@ void QMLViewport::wheelEvent(QWheelEvent *event) {
518518
PointerEvent ev(
519519
EventType::MouseWheel,
520520
static_cast<Signature::Button>((int)event->buttons()),
521-
event->position().x(),
522-
event->position().y(),
523-
width(), // FIXME should be width, but this function appears to never be called.
524-
height(), // FIXME should be height
521+
int(round(float(event->position().x()) * window()->effectiveDevicePixelRatio())),
522+
int(round(float(event->position().y()) * window()->effectiveDevicePixelRatio())),
523+
int(round(float(width()) * window()->effectiveDevicePixelRatio())),
524+
int(round(float(height()) * window()->effectiveDevicePixelRatio())),
525525
qtModifierToOurs(event->modifiers()),
526526
renderer_actor ? renderer_actor->std_name() : "",
527527
std::make_pair(event->angleDelta().rx(), event->angleDelta().ry()),

0 commit comments

Comments
 (0)