···268268 switch (event) {
269269 .mouse => |mouse| {
270270 // 1. Process vertical scroll thumb hover.
271271-271271+ const mouse_col: u16 = if (mouse.col < 0) 0 else @intCast(mouse.col);
272272+ const mouse_row: u16 = if (mouse.row < 0) 0 else @intCast(mouse.row);
272273 const is_mouse_over_vertical_thumb =
273273- mouse.col == self.last_frame_size.width -| 1 and
274274- mouse.row >= self.vertical_thumb_top_row and
275275- mouse.row < self.vertical_thumb_bottom_row;
274274+ mouse_col == self.last_frame_size.width -| 1 and
275275+ mouse_row >= self.vertical_thumb_top_row and
276276+ mouse_row < self.vertical_thumb_bottom_row;
276277277278 // Make sure we only update the state and redraw when it's necessary.
278279 if (!self.is_hovering_vertical_thumb and is_mouse_over_vertical_thumb) {
···288289289290 if (did_start_dragging_vertical_thumb) {
290291 self.is_dragging_vertical_thumb = true;
291291- self.mouse_offset_into_thumb = @intCast(mouse.row -| self.vertical_thumb_top_row);
292292+ self.mouse_offset_into_thumb = @intCast(mouse_row -| self.vertical_thumb_top_row);
292293293294 // No need to redraw yet, but we must consume the event.
294295 return ctx.consumeEvent();
···297298 // 2. Process horizontal scroll thumb hover.
298299299300 const is_mouse_over_horizontal_thumb =
300300- mouse.row == self.last_frame_size.height -| 1 and
301301- mouse.col >= self.horizontal_thumb_start_col and
302302- mouse.col < self.horizontal_thumb_end_col;
301301+ mouse_row == self.last_frame_size.height -| 1 and
302302+ mouse_col >= self.horizontal_thumb_start_col and
303303+ mouse_col < self.horizontal_thumb_end_col;
303304304305 // Make sure we only update the state and redraw when it's necessary.
305306 if (!self.is_hovering_horizontal_thumb and is_mouse_over_horizontal_thumb) {
···316317 if (did_start_dragging_horizontal_thumb) {
317318 self.is_dragging_horizontal_thumb = true;
318319 self.mouse_offset_into_thumb = @intCast(
319319- mouse.col -| self.horizontal_thumb_start_col,
320320+ mouse_col -| self.horizontal_thumb_start_col,
320321 );
321322322323 // No need to redraw yet, but we must consume the event.