diff options
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; |