Skip to content

Commit

Permalink
refactor(wasm-api-dom): update Event struct
Browse files Browse the repository at this point in the history
- switch clientX/Y to u16
  • Loading branch information
postspectacular committed Oct 3, 2022
1 parent ca79685 commit 80b1d7a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/wasm-api-dom/include/api.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Generated by @thi.ng/wasm-api at 2022-10-02T18:59:48.751Z - DO NOT EDIT!
//! Generated by @thi.ng/wasm-api at 2022-10-03T00:05:37.977Z - DO NOT EDIT!

pub const EventType = enum(i32) {
UNKOWN = -1,
Expand Down Expand Up @@ -27,8 +27,8 @@ pub const WindowInfo = struct {

pub const Event = struct {
target: i32,
clientX: u32 = 0,
clientY: u32 = 0,
clientX: u16 = 0,
clientY: u16 = 0,
type: EventType,
buttons: u8 = 0,
modifiers: u8 = 0,
Expand Down
28 changes: 14 additions & 14 deletions packages/wasm-api-dom/src/generated/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by @thi.ng/wasm-api at 2022-10-02T18:59:48.748Z - DO NOT EDIT!
* Generated by @thi.ng/wasm-api at 2022-10-03T00:05:37.974Z - DO NOT EDIT!
*/

// @ts-ignore possibly includes unused imports
Expand Down Expand Up @@ -82,15 +82,15 @@ export const $Event: WasmTypeConstructor<Event> = (mem) => ({
return 4;
},
get size() {
return 28;
return 24;
},
instance: (base) => {
return {
get __base() {
return base;
},
get __bytes() {
return mem.u8.subarray(base, base + 28);
return mem.u8.subarray(base, base + 24);
},
get target(): number {
return mem.i32[base >>> 2];
Expand All @@ -99,37 +99,37 @@ export const $Event: WasmTypeConstructor<Event> = (mem) => ({
mem.i32[base >>> 2] = x;
},
get clientX(): number {
return mem.u32[(base + 4) >>> 2];
return mem.u16[(base + 4) >>> 1];
},
set clientX(x: number) {
mem.u32[(base + 4) >>> 2] = x;
mem.u16[(base + 4) >>> 1] = x;
},
get clientY(): number {
return mem.u32[(base + 8) >>> 2];
return mem.u16[(base + 6) >>> 1];
},
set clientY(x: number) {
mem.u32[(base + 8) >>> 2] = x;
mem.u16[(base + 6) >>> 1] = x;
},
get type(): EventType {
return mem.i32[(base + 12) >>> 2];
return mem.i32[(base + 8) >>> 2];
},
set type(x: EventType) {
mem.i32[(base + 12) >>> 2] = x;
mem.i32[(base + 8) >>> 2] = x;
},
get buttons(): number {
return mem.u8[(base + 16)];
return mem.u8[(base + 12)];
},
set buttons(x: number) {
mem.u8[(base + 16)] = x;
mem.u8[(base + 12)] = x;
},
get modifiers(): number {
return mem.u8[(base + 17)];
return mem.u8[(base + 13)];
},
set modifiers(x: number) {
mem.u8[(base + 17)] = x;
mem.u8[(base + 13)] = x;
},
get key(): Uint8Array {
const addr = (base + 18);
const addr = (base + 14);
return mem.u8.subarray(addr, addr + 8);
},
};
Expand Down
4 changes: 2 additions & 2 deletions packages/wasm-api-dom/typedefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"type": "struct",
"fields": [
{ "name": "target", "type": "i32" },
{ "name": "clientX", "type": "u32", "default": 0 },
{ "name": "clientY", "type": "u32", "default": 0 },
{ "name": "clientX", "type": "u16", "default": 0 },
{ "name": "clientY", "type": "u16", "default": 0 },
{ "name": "type", "type": "EventType" },
{ "name": "buttons", "type": "u8", "default": 0 },
{ "name": "modifiers", "type": "u8", "default": 0 },
Expand Down

0 comments on commit 80b1d7a

Please sign in to comment.