From 7f60b7c4e8d99f97a0a24b60bd4c4fd15697a4bb Mon Sep 17 00:00:00 2001 From: rebecca Date: Tue, 14 Jul 2026 20:53:05 +0100 Subject: rect: add wh field, adjust has() comparisons --- rect.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rect.lua b/rect.lua index 0a1b79c..1aedacd 100644 --- a/rect.lua +++ b/rect.lua @@ -7,6 +7,7 @@ function Rect.from_coords(cls, x0, y0, x1, y1) return setmetatable({ tl=Pos:make(x0,y0), br=Pos:make(x1,y1), + wh=Pos:make(x1-x0,y1-y0), x0=x0, y0=y0, x1=x1, y1=y1, w=x1-x0, h=y1-y0, }, cls) @@ -15,7 +16,7 @@ function Rect.from_pos(cls, tl, br) assert(tl.x