Button hover bug fix

physics
E. Almqvist 3 years ago
parent 87b8048edc
commit 653e746172
  1. 4
      src/lib/ui.rb

@ -74,8 +74,8 @@ class Button < UI
end end
def hover? def hover?
inx = window.mouse_x >= self.x && window.mouse_x <= self.x + self.width + self.padding[:x] inx = window.mouse_x >= self.x && window.mouse_x <= self.x + self.width
iny = window.mouse_y >= self.y && window.mouse_y <= self.y + self.height + self.padding[:y] 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 # doing `n in (a..b).to....` is too slow
# hence the ugly syntax above # hence the ugly syntax above

Loading…
Cancel
Save