Skip to content

Commit

Permalink
Improve get_window_scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Jan 18, 2024
1 parent abd0158 commit 27268a2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wasm/dom/dom_all_targets.odin
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ get_window_position :: proc "contextless" () -> (pos: [2]f64) {
panic("vendor:wasm/js not supported on non JS targets")
}

get_window_scroll :: proc "contextless" () -> (x, y: f64) {
get_window_scroll :: proc "contextless" () -> (scroll: [2]f64) {
context = runtime.default_context()
panic("vendor:wasm/js not supported on non JS targets")
}
4 changes: 2 additions & 2 deletions wasm/dom/dom_js.odin
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ get_window_position :: proc "contextless" () -> (pos: [2]f64) {
return
}

get_window_scroll :: proc "contextless" () -> (x, y: f64) {
// Get `window.scrollX` and `window.scrollY`
get_window_scroll :: proc "contextless" () -> (scroll: [2]f64) {
foreign dom_lib {
@(link_name = "get_window_scroll")
_get_window_scroll :: proc "contextless" (scroll: ^[2]f64) ---
}
scroll := [2]f64{x, y}
_get_window_scroll(&scroll)
return
}
2 changes: 1 addition & 1 deletion wasm/memory_js.odin
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ page_allocator :: proc() -> mem.Allocator {
case .Alloc, .Alloc_Non_Zeroed:
assert(size % PAGE_SIZE == 0)
return page_alloc(size / PAGE_SIZE)
case .Resize, .Free, .Free_All, .Query_Info:
case .Resize, .Free, .Free_All, .Query_Info, .Resize_Non_Zeroed:
return nil, .Mode_Not_Implemented
case .Query_Features:
set := (^mem.Allocator_Mode_Set)(old_memory)
Expand Down

0 comments on commit 27268a2

Please sign in to comment.