Commit Graph

7 Commits

Author SHA1 Message Date
Kartik K. Agaram c7a81906cc 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.
2024-02-23 15:23:28 -08:00
Kartik K. Agaram 3293f3e139 some keyboard shortcuts on non-mobile devices
Hopefully this is easy to remember from left to right:
- run is F1
- stop is F2
- hide/show is F3
- save is F4
- load is F5

There are also tooltips to introduce these shortcuts to newcomers.

Most of the shortcuts are only enabled when code is visible. In keeping
with existing conventions for mouse events, we leave most event handlers
for the script when code is hidden. The only exception is 'F3' to show
code. So if you want to use a shortcut 'k' when code is hidden, you have
to instead use 'F3 k F3'.

This is all tentative and open to change. But I'll probably grow more
reluctant to change the shortcuts in a few weeks or months.
2024-02-22 18:27:39 -08:00
Kartik K. Agaram 56268f09a4 add keyboard shortcuts for common operations 2024-02-21 06:45:37 -08:00
Kartik K. Agaram 966f8a15bf simplify state management for menus 2023-12-04 22:09:47 -08:00
Kartik K. Agaram e93d43253d close all menus when tapping any button
I think I'm least likely to break something if I do this as explicitly
as possible rather than trying to figure out the right helper to put it
in once and for all. So just add some boilerplate to reset all state at
the start of each onpress1 handler. This seems like a good choice since
we aren't planning to add a lot more menus that would quadratically
explode the boilerplate.
2023-12-04 21:34:39 -08:00
Kartik K. Agaram 511aace3f1 new example: interactivity
In the process I made a few bugfixes:
* To improve the debug experience for myself I clear the canvas when
  recovering from any errors. (This should probably get ported
  upstream..)
* The `car` handlers for each pane are now siloed from each other. When
  you navigate away they go away, when you navigate back they're still
  active. Very nice.
2023-11-21 22:02:24 -08:00
Kartik K. Agaram f580e2efca add lots of buttons to the toolbar 2023-11-20 22:23:09 -08:00