this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: support negative mouse coordiantes in vxfw/ScrollBars

authored by

CJ van den Berg and committed by
Tim Culverhouse
eba27677 cec2f383

+10 -9
+10 -9
src/vxfw/ScrollBars.zig
··· 268 268 switch (event) { 269 269 .mouse => |mouse| { 270 270 // 1. Process vertical scroll thumb hover. 271 - 271 + const mouse_col: u16 = if (mouse.col < 0) 0 else @intCast(mouse.col); 272 + const mouse_row: u16 = if (mouse.row < 0) 0 else @intCast(mouse.row); 272 273 const is_mouse_over_vertical_thumb = 273 - mouse.col == self.last_frame_size.width -| 1 and 274 - mouse.row >= self.vertical_thumb_top_row and 275 - mouse.row < self.vertical_thumb_bottom_row; 274 + mouse_col == self.last_frame_size.width -| 1 and 275 + mouse_row >= self.vertical_thumb_top_row and 276 + mouse_row < self.vertical_thumb_bottom_row; 276 277 277 278 // Make sure we only update the state and redraw when it's necessary. 278 279 if (!self.is_hovering_vertical_thumb and is_mouse_over_vertical_thumb) { ··· 288 289 289 290 if (did_start_dragging_vertical_thumb) { 290 291 self.is_dragging_vertical_thumb = true; 291 - self.mouse_offset_into_thumb = @intCast(mouse.row -| self.vertical_thumb_top_row); 292 + self.mouse_offset_into_thumb = @intCast(mouse_row -| self.vertical_thumb_top_row); 292 293 293 294 // No need to redraw yet, but we must consume the event. 294 295 return ctx.consumeEvent(); ··· 297 298 // 2. Process horizontal scroll thumb hover. 298 299 299 300 const is_mouse_over_horizontal_thumb = 300 - mouse.row == self.last_frame_size.height -| 1 and 301 - mouse.col >= self.horizontal_thumb_start_col and 302 - mouse.col < self.horizontal_thumb_end_col; 301 + mouse_row == self.last_frame_size.height -| 1 and 302 + mouse_col >= self.horizontal_thumb_start_col and 303 + mouse_col < self.horizontal_thumb_end_col; 303 304 304 305 // Make sure we only update the state and redraw when it's necessary. 305 306 if (!self.is_hovering_horizontal_thumb and is_mouse_over_horizontal_thumb) { ··· 316 317 if (did_start_dragging_horizontal_thumb) { 317 318 self.is_dragging_horizontal_thumb = true; 318 319 self.mouse_offset_into_thumb = @intCast( 319 - mouse.col -| self.horizontal_thumb_start_col, 320 + mouse_col -| self.horizontal_thumb_start_col, 320 321 ); 321 322 322 323 // No need to redraw yet, but we must consume the event.