diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2024-05-30 01:49:30 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-05-30 01:49:30 +0200 |
| commit | 692ca13ffd0b84ffe1a1b67dbc618d17e11a0315 (patch) | |
| tree | 35f08ebd26fcc509706fdb79ca0cb2afac54c140 | |
| parent | 75f1215ed283e29dda4b8c84ac8929d7d54189e5 (diff) | |
wasm: fix the WheelEvent not storing data properly
A `WheelEvent` is also an instanceof `MouseEvent` so it was never
hitting the if statement for the `WheelEvent`.
| -rw-r--r-- | vendor/wasm/js/runtime.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/vendor/wasm/js/runtime.js b/vendor/wasm/js/runtime.js index 8b4ad157b..f3df85648 100644 --- a/vendor/wasm/js/runtime.js +++ b/vendor/wasm/js/runtime.js @@ -1443,7 +1443,12 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement) { wmi.storeU8(off(1), !!e.isTrusted); let base = off(0, 8); - if (e instanceof MouseEvent) { + if (e instanceof WheelEvent) { + wmi.storeF64(off(8), e.deltaX); + wmi.storeF64(off(8), e.deltaY); + wmi.storeF64(off(8), e.deltaZ); + wmi.storeU32(off(4), e.deltaMode); + } else if (e instanceof MouseEvent) { wmi.storeI64(off(8), e.screenX); wmi.storeI64(off(8), e.screenY); wmi.storeI64(off(8), e.clientX); @@ -1482,11 +1487,6 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement) { wmi.storeI32(off(W), e.code.length) wmi.storeString(off(16, 1), e.key); wmi.storeString(off(16, 1), e.code); - } else if (e instanceof WheelEvent) { - wmi.storeF64(off(8), e.deltaX); - wmi.storeF64(off(8), e.deltaY); - wmi.storeF64(off(8), e.deltaZ); - wmi.storeU32(off(4), e.deltaMode); } else if (e.type === 'scroll') { wmi.storeF64(off(8), window.scrollX); wmi.storeF64(off(8), window.scrollY); |