From 034ac8e5128e3dc917b3a98bead6db71a5249739 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:28:24 -0300 Subject: Presentation: a cell is in a box by one test, animation.Box.contains, now the centre test its comment always said (its one other caller passes whole-cell pane boxes, where centre and corner agree), so boxContainsCell goes; the aliases used once are spelled where they are used Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/animation.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/animation.zig') diff --git a/src/animation.zig b/src/animation.zig index ae116e27..51164495 100644 --- a/src/animation.zig +++ b/src/animation.zig @@ -96,10 +96,11 @@ pub const Box = extern struct { return a.x == b.x and a.y == b.y and a.w == b.w and a.h == b.h; } - // A cell belongs to a fractional box when its center lies inside. + /// A cell belongs to a fractional box when its centre lies inside: + /// drawing and hit testing both ask this. pub fn contains(box: Box, col: u16, row: u16) bool { - const x: f32 = @floatFromInt(col); - const y: f32 = @floatFromInt(row); + const x = @as(f32, @floatFromInt(col)) + 0.5; + const y = @as(f32, @floatFromInt(row)) + 0.5; return x >= box.x and x < box.x + box.w and y >= box.y and y < box.y + box.h; } }; -- cgit v1.3