Skip to content

Commit

Permalink
Use offsetX/offsetY for pointer events
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mboc-qt authored and Morten Johan Sørvig committed Nov 2, 2022
1 parent 8acec4d commit 899e540
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/platforms/wasm/qwasmevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ std::optional<PointerEvent> PointerEvent::fromWeb(emscripten::val event)
PointerType::Mouse : PointerType::Other;
ret.mouseButton = MouseEvent::buttonFromWeb(event["button"].as<int>());
ret.mouseButtons = MouseEvent::buttonsFromWeb(event["buttons"].as<unsigned short>());
ret.point = QPoint(event["x"].as<int>(), event["y"].as<int>());
ret.point = QPoint(event["offsetX"].as<int>(), event["offsetY"].as<int>());
ret.pointerId = event["pointerId"].as<int>();
ret.modifiers = KeyboardModifier::getForEvent(event);

Expand Down

0 comments on commit 899e540

Please sign in to comment.