Skip to content

Commit a367b89

Browse files
undo-krockorager
authored andcommitted
fix(vxfw): out of bounds panic on ScrollBars
1 parent 60a507c commit a367b89

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/vxfw/ScrollBars.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub fn handleCapture(self: *ScrollBars, ctx: *vxfw.EventContext, event: vxfw.Eve
166166

167167
// If the new thumb position is at the top we know we've scrolled to the top of
168168
// the scroll view.
169-
if (new_thumb_top == 0) {
169+
if (new_thumb_top <= 0) {
170170
self.scroll_view.scroll.top = 0;
171171
return ctx.consumeAndRedraw();
172172
}
@@ -238,7 +238,7 @@ pub fn handleCapture(self: *ScrollBars, ctx: *vxfw.EventContext, event: vxfw.Eve
238238

239239
// If the new thumb position is at the horizontal beginning of the current view
240240
// we know we've scrolled to the beginning of the scroll view.
241-
if (new_thumb_col_start == 0) {
241+
if (new_thumb_col_start <= 0) {
242242
self.scroll_view.scroll.left = 0;
243243
return ctx.consumeAndRedraw();
244244
}

0 commit comments

Comments
 (0)