772dbdd6
Fix selection clear on off-grid click and clampGridPoint row clamping
a73x 2026-04-09 18:47
Commit message
src/main.zig
| Old | New | ||
|---|---|---|---|
| @@ -689,10 +689,9 @@ fn clampGridPoint(point: GridPoint, cols: u16, rows: u16) ?GridPoint { | |||
| 689 | if (cols == 0 or rows == 0) return null; | 689 | if (cols == 0 or rows == 0) return null; |
| 690 | const max_col = @as(u32, cols) - 1; | 690 | const max_col = @as(u32, cols) - 1; |
| 691 | const max_row = @as(u32, rows) - 1; | 691 | const max_row = @as(u32, rows) - 1; |
| 692 | if (point.row > max_row) return null; | ||
| 693 | return .{ | 692 | return .{ |
| 694 | .col = @min(point.col, max_col), | 693 | .col = @min(point.col, max_col), |
| 695 | .row = point.row, | 694 | .row = @min(point.row, max_row), |
| 696 | }; | 695 | }; |
| 697 | } | 696 | } |
| 698 | 697 | ||
| @@ -731,10 +730,10 @@ fn handlePointerSelectionEvent( | |||
| 731 | }, | 730 | }, |
| 732 | .button_press => |b| { | 731 | .button_press => |b| { |
| 733 | if (b.button == BTN_LEFT) { | 732 | if (b.button == BTN_LEFT) { |
| 733 | state.committed = null; | ||
| 734 | if (state.hover) |hover| { | 734 | if (state.hover) |hover| { |
| 735 | state.anchor = hover; | 735 | state.anchor = hover; |
| 736 | state.active = .{ .start = hover, .end = hover }; | 736 | state.active = .{ .start = hover, .end = hover }; |
| 737 | state.committed = null; | ||
| 738 | } | 737 | } |
| 739 | } | 738 | } |
| 740 | }, | 739 | }, |