mach: implement setCursorMode for wasm
This commit is contained in:
parent
3ea1dea4f7
commit
a27121c00a
2 changed files with 13 additions and 2 deletions
|
|
@ -323,6 +323,16 @@ const mach = {
|
|||
}
|
||||
},
|
||||
|
||||
machSetCursorMode(cursor_ptr, len) {
|
||||
let mach_name = mach.getString(cursor_ptr, len);
|
||||
|
||||
if (mach_name === 'normal') document.body.style.cursor = 'default';
|
||||
else if (mach_name === 'hidden' || mach_name === 'disabled') document.body.style.cursor = 'none';
|
||||
else {
|
||||
console.log("machSetMouseCursor failed for " + mach_name);
|
||||
}
|
||||
},
|
||||
|
||||
machSetWaitEvent(timeout) {
|
||||
mach.wait_event_timeout = timeout;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -123,8 +123,9 @@ pub const Platform = struct {
|
|||
js.machSetMouseCursor(cursor_name.ptr, cursor_name.len);
|
||||
}
|
||||
|
||||
pub fn setCursorMode(_: *Platform, _: enums.CursorMode) !void {
|
||||
@panic("TODO: Implement setCursorMode for wasm");
|
||||
pub fn setCursorMode(_: *Platform, mode: enums.CursorMode) !void {
|
||||
const mode_name = @tagName(mode);
|
||||
js.machSetCursorMode(mode_name.ptr, mode_name.len);
|
||||
}
|
||||
|
||||
fn pollChanges(platform: *Platform) void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue