Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webvr: touchstart is not sufficient as a user gesture #38

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions doc/webvr.dox
Expand Up @@ -37,10 +37,7 @@ This example is a basic demonstration of how to use the
with Magnum.

For the full experience, this example requires a WebVR 1.1 capable browser and
a VR headset. Note that Emscripten currently has
[a pending API change](https://github.com/kripken/emscripten/pull/5640), the
code of this example is modified to support both current and the next API
version.
a VR headset. You may need to enable WebVR support explicitly on your browser.

@m_div{m-button m-primary} <a href="http://magnum.graphics/showcase/webvr/">@m_div{m-big} Live web demo @m_enddiv @m_div{m-small} uses WebAssembly & WebGL @m_enddiv </a> @m_enddiv

Expand Down
4 changes: 2 additions & 2 deletions src/webvr/WebVrExample.cpp
Expand Up @@ -89,7 +89,7 @@ EM_BOOL clickCallback(int eventType, const EmscriptenMouseEvent* e, void* app) {

/* Touch callback for requesting present on mobile */
EM_BOOL touchCallback(int eventType, const EmscriptenTouchEvent* e, void* app) {
if(!e || eventType != EMSCRIPTEN_EVENT_TOUCHSTART) return EM_FALSE;
if(!e || eventType != EMSCRIPTEN_EVENT_TOUCHEND) return EM_FALSE;

static_cast<WebVrExample*>(app)->onClick();
return EM_FALSE;
Expand Down Expand Up @@ -193,7 +193,7 @@ void WebVrExample::vrReady() {

/* Set callbacks for getting present permission for the VR display */
emscripten_set_click_callback("#canvas", this, true, clickCallback);
emscripten_set_touchstart_callback("#canvas", this, true, touchCallback);
emscripten_set_touchend_callback("#canvas", this, true, touchCallback);

_vrInitialized = true;
}
Expand Down