diff options
| author | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-01-27 15:01:34 +0100 |
|---|---|---|
| committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-02-14 19:01:17 +0100 |
| commit | da5dc2062576b75b6427fcc2bc74dc4fcfd9dcf5 (patch) | |
| tree | 40c662bbbf5e916f84e6e14acb86932359b9caa7 /src/plugins/platforms/wasm/qwasmevent.cpp | |
| parent | 22fc1d08bb666bb91470ad3759b91256a56ef4fa (diff) | |
Transfer touch event handling to QWasmWindow
Fixes: QTBUG-103498
Change-Id: Iec8b5cfba75131e7ddf855e6b729291950888fd3
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmevent.cpp')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmevent.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/wasm/qwasmevent.cpp b/src/plugins/platforms/wasm/qwasmevent.cpp index ba6e3e95be6..d6f254bc9f1 100644 --- a/src/plugins/platforms/wasm/qwasmevent.cpp +++ b/src/plugins/platforms/wasm/qwasmevent.cpp @@ -133,8 +133,17 @@ MouseEvent &MouseEvent::operator=(MouseEvent &&other) = default; PointerEvent::PointerEvent(EventType type, emscripten::val event) : MouseEvent(type, event) { pointerId = event["pointerId"].as<int>(); - pointerType = event["pointerType"].as<std::string>() == "mouse" ? PointerType::Mouse - : PointerType::Other; + pointerType = ([type = event["pointerType"].as<std::string>()]() { + if (type == "mouse") + return PointerType::Mouse; + if (type == "touch") + return PointerType::Touch; + return PointerType::Other; + })(); + width = event["width"].as<qreal>(); + height = event["height"].as<qreal>(); + pressure = event["pressure"].as<qreal>(); + isPrimary = event["isPrimary"].as<bool>(); } PointerEvent::~PointerEvent() = default; |
