diff options
| author | BeardedBread <[email protected]> | 2023-10-15 04:42:03 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-14 22:42:03 +0200 |
| commit | b79e38109268bc23eeceb05212017d3ed1359170 (patch) | |
| tree | db4940bc7b4d2b0015a950b9e7717d77e50a8223 /src | |
| parent | bf639f02a8a05f678c6d2459871a9e466be34b97 (diff) | |
| download | raylib-b79e38109268bc23eeceb05212017d3ed1359170.tar.gz raylib-b79e38109268bc23eeceb05212017d3ed1359170.zip | |
Fix SetMouseCursor implementation for PLATFORM_WEB (#3416)
* Fix SetMouseCursor implementation for PLATFORM_WEB
- Restrict function to only set the cursor inside the canvas
* Set the CORE input mouse
Diffstat (limited to 'src')
| -rw-r--r-- | src/rcore_web.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rcore_web.c b/src/rcore_web.c index 71e818ea..34836b7f 100644 --- a/src/rcore_web.c +++ b/src/rcore_web.c @@ -659,6 +659,7 @@ void SetMousePosition(int x, int y) // Set mouse cursor void SetMouseCursor(int cursor) { + CORE.Input.Mouse.cursor = cursor; const char *cursorName; switch (cursor) { @@ -682,11 +683,13 @@ void SetMouseCursor(int cursor) { TRACELOG(LOG_WARNING, "Cursor value out of bound (%d). Setting to default", cursor); cursorName = "default"; + CORE.Input.Mouse.cursor = MOUSE_CURSOR_DEFAULT; } break; } - // Set the cursor element on the CSS - EM_ASM({document.body.style.cursor = UTF8ToString($0);}, cursorName); + // Set the cursor element on the canvas CSS + // The canvas is coded to the Id "canvas" on init + EM_ASM({document.getElementById("canvas").style.cursor = UTF8ToString($0);}, cursorName); } // Register all input events |
