From 653e746172c2aaa182d916090588d0214bf5b84e Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 15 Nov 2021 08:22:28 +0100 Subject: [PATCH] Button hover bug fix --- src/lib/ui.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ui.rb b/src/lib/ui.rb index 1cc12cf..bd0ec1b 100644 --- a/src/lib/ui.rb +++ b/src/lib/ui.rb @@ -74,8 +74,8 @@ class Button < UI end def hover? - inx = window.mouse_x >= self.x && window.mouse_x <= self.x + self.width + self.padding[:x] - iny = window.mouse_y >= self.y && window.mouse_y <= self.y + self.height + self.padding[:y] + inx = window.mouse_x >= self.x && window.mouse_x <= self.x + self.width + iny = window.mouse_y >= self.y - self.padding[:y] && window.mouse_y <= self.y + self.height + self.padding[:y] # doing `n in (a..b).to....` is too slow # hence the ugly syntax above