diff options
-rw-r--r-- | src/plugins/platforms/wasm/qwasmscreen.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp index 03c672b9ba..84bb6bb86d 100644 --- a/src/plugins/platforms/wasm/qwasmscreen.cpp +++ b/src/plugins/platforms/wasm/qwasmscreen.cpp @@ -97,7 +97,7 @@ QWasmScreen::QWasmScreen(const emscripten::val &containerOrCanvas) m_onContextMenu = std::make_unique<qstdweb::EventCallback>(m_canvas, "contextmenu", [](emscripten::val event){ event.call<void>("preventDefault"); }); - + // Create "specialHTMLTargets" mapping for the canvas. Normally, Emscripten // uses the html element id when targeting elements, for example when registering // event callbacks. However, this approach is limited to supporting single-document @@ -105,9 +105,8 @@ QWasmScreen::QWasmScreen(const emscripten::val &containerOrCanvas) // As a workaround for this, Emscripten supports registering custom mappings in the // "specialHTMLTargets" object. Add a mapping for the canvas for this screen. emscripten::val specialHtmlTargets = emscripten::val::module_property("specialHTMLTargets"); - std::string id = std::string("!qtcanvas_") + std::to_string(uint32_t(this)); - specialHtmlTargets.set(id, m_canvas.as_handle()); + specialHtmlTargets.set(id, m_canvas); // Install event handlers on the container/canvas. This must be // done after the canvas has been created above. |