Remove automatic pointer lock on mouse click #1513
This commit is contained in:
parent
f2c0981c57
commit
721768bdb0
1 changed files with 7 additions and 11 deletions
18
src/core.c
18
src/core.c
|
@ -1738,6 +1738,9 @@ void EnableCursor(void)
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
emscripten_exit_pointerlock();
|
||||||
|
#endif
|
||||||
#if defined(PLATFORM_UWP)
|
#if defined(PLATFORM_UWP)
|
||||||
UWPGetMouseUnlockFunc()();
|
UWPGetMouseUnlockFunc()();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1750,6 +1753,9 @@ void DisableCursor(void)
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
emscripten_request_pointerlock("#canvas", 1);
|
||||||
|
#endif
|
||||||
#if defined(PLATFORM_UWP)
|
#if defined(PLATFORM_UWP)
|
||||||
UWPGetMouseLockFunc()();
|
UWPGetMouseLockFunc()();
|
||||||
#endif
|
#endif
|
||||||
|
@ -5092,17 +5098,7 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
|
||||||
// Lock mouse pointer when click on screen
|
// Lock mouse pointer when click on screen
|
||||||
if (eventType == EMSCRIPTEN_EVENT_CLICK)
|
if (eventType == EMSCRIPTEN_EVENT_CLICK)
|
||||||
{
|
{
|
||||||
EmscriptenPointerlockChangeEvent plce;
|
// TODO: Manage mouse events if required (note that GLFW JS wrapper manages it now)
|
||||||
emscripten_get_pointerlock_status(&plce);
|
|
||||||
|
|
||||||
int result = emscripten_request_pointerlock("#canvas", 1); // TODO: It does not work!
|
|
||||||
|
|
||||||
// result -> EMSCRIPTEN_RESULT_DEFERRED
|
|
||||||
// The requested operation cannot be completed now for web security reasons,
|
|
||||||
// and has been deferred for completion in the next event handler. --> but it never happens!
|
|
||||||
|
|
||||||
//if (!plce.isActive) emscripten_request_pointerlock(0, 1);
|
|
||||||
//else emscripten_exit_pointerlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue