From 899e540d46adb72f212091ffb5fd3bf2262a556c Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Tue, 1 Nov 2022 12:53:11 +0100 Subject: [PATCH] Use offsetX/offsetY for pointer events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qtwasmcompositor expects coordinates relative to the canvas. Provide that by using pointer events' offsetX/offsetY instead of the viewport x/y. Fixes: QTBUG-108128 Fixes: QTBUG-106031 Pick-to: 6.4 6.4.1 Change-Id: I76c553b7b7e350fd873b18c775848217a4905f3d Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wasm/qwasmevent.cpp b/src/plugins/platforms/wasm/qwasmevent.cpp index b094dbfe140..f066d0041ec 100644 --- a/src/plugins/platforms/wasm/qwasmevent.cpp +++ b/src/plugins/platforms/wasm/qwasmevent.cpp @@ -43,7 +43,7 @@ std::optional PointerEvent::fromWeb(emscripten::val event) PointerType::Mouse : PointerType::Other; ret.mouseButton = MouseEvent::buttonFromWeb(event["button"].as()); ret.mouseButtons = MouseEvent::buttonsFromWeb(event["buttons"].as()); - ret.point = QPoint(event["x"].as(), event["y"].as()); + ret.point = QPoint(event["offsetX"].as(), event["offsetY"].as()); ret.pointerId = event["pointerId"].as(); ret.modifiers = KeyboardModifier::getForEvent(event);