A lightweight programming environment for desktop and mobile devices

slightly shrink the clickable area for a button

The reason is tooltips for buttons that lie along the left or bottom edge of the app window. Since adding tooltips I noticed that the tooltip on the 'next' button (which lies all down the right margin of the window) would continue to be visible after the mouse moves off the window. It turns out that LÖVE doesn't disable the mouse position somehow after it goes off screen. It just remains at 0 or width-1 or height-1.

Why was I not seeing the same issue with the 'previous' button? Kinda by happy accident. The checks in button.lua were comparing using < and >, not <= or >=. And the x coordinate when the mouse goes off window is 0.

So the quick solution is to remove one px of clickable area from the bottom and right. It doesn't seem too hacky; the icon switches to resizing the window anyway when you're right at the border.

I'm also focusing now on the fact that pixel values in LÖVE go from 0 to width-1 in spite of Lua's 1-based indexing in most places.

Created by  akkartik  on February 23, 2024
OL5RDL6ZVYSPSTOH4EQYFEQQPQHW35B5YWV725FN534SAIWZ6QFQC
Change contents