summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmeventtranslator.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
index a4ec78f27b..d6ea147ccf 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
@@ -47,9 +47,10 @@
#include <iostream>
-QT_BEGIN_NAMESPACE
using namespace emscripten;
+QT_BEGIN_NAMESPACE
+
typedef struct emkb2qt {
const char *em;
unsigned int qt;
@@ -353,10 +354,11 @@ void QWasmEventTranslator::initEventHandlers()
g_useNaturalScrolling = false; // make this !default on macOS
if (emscripten::val::global("window")["safari"].isUndefined()) {
-
- emscripten::val::global(canvasId).call<void>("addEventListener",
- std::string("wheel"),
- val::module_property("qtMouseWheelEvent"));
+ val document = val::global("document");
+ val canvas = document.call<val>("getElementById", val(canvasId));
+ canvas.call<void>("addEventListener",
+ std::string("wheel"),
+ val::module_property("qtMouseWheelEvent"));
}
}