Commit Graph

21 Commits

Author SHA1 Message Date
Kartik K. Agaram 38d21ab237 merge bugfix 2023-12-17 00:53:12 -08:00
Kartik K. Agaram 2f09322d49 greatly simplify slider implementation
It now looks a lot like button.lua.
2023-12-16 23:41:49 -08:00
Kartik K. Agaram 3bab3fcd57 bugfix: catch errors in mouse_press handlers 2023-12-07 12:39:20 -08:00
Kartik K. Agaram 966f8a15bf simplify state management for menus 2023-12-04 22:09:47 -08:00
Kartik K. Agaram 107e41d522 bugfix: typo X-( 2023-12-02 22:27:36 -08:00
Kartik K. Agaram 66c9f61ddc bugfix: tapping in scrollbar area
scenario 1: tap on scrollbar area off scrollbar.
With the previous commit the app would crash.

scenario 2: drag down a bit, then let go, then drag the scrollbar again.
With the previous commit the scrollbar would start again from 0.

Root cause: units mismatch (pixels vs normalized y between 0 and 1)
2023-12-02 18:36:11 -08:00
Kartik K. Agaram 10efcfef8a UI improvement: more stable scrollbar movement
scenario: just tap somewhere on a scrollbar.

There should be no scrolling. But before this commit there would be.
This made the scrollbars feel unstable.

I finally figured this out while noodling over a follow-up question to
the previous commit:

  Why was dragging the scrollbar down ever leaving a trail of more than
  just the top line's `starty`? In other words, why was my example:

    line 1: 30
    line 2: 60
    line 3: 90
    line 4: 30
    line 5: 30
    line 6: 30
    ...

  ..and not:

    line 1: 30
    line 2: 30
    line 3: 30
    line 4: 30
    line 5: 30
    line 6: 30
    ...

  ??

The answer: when I grab a scrollbar it always used to jump down!

Usability issues can either exacerbate bugs or make them harder to
diagnose. If I'd implemented scrollbars like this from the start, we'd
either never have noticed the problem of the previous commit or fixed it
much more quickly.
2023-12-02 17:22:44 -08:00
Kartik K. Agaram ca3b15dded rename a function 2023-12-01 21:00:38 -08:00
Kartik K. Agaram 7ca2006145 partition handlers between screen regions
This fixes one bug I know of: dragging the mouse atop the settings menu
was selecting text in the editor underneath.
2023-12-01 20:59:22 -08:00
Kartik K. Agaram 0d2d85d8d7 activate buttons for some time
The active state has 2 uses:
* It gives some visual feedback that a button has been pressed.
  Otherwise, tapping a button gave no feedback that the tap had
  occurred. Particularly on a phone screen where fat-fingering is
  easier, hitting the 'save' button in particular gave no hint that the
  file had actually been saved. Which causes some anxiety.
* It suppresses all mouse taps during the activation time. For example,
  this helps keep tapping say an overflow button from selecting text in
  the editor.
2023-12-01 20:07:20 -08:00
Kartik K. Agaram d0e2e682c5 bugfix: autosave settings
Before this commit we were only saving settings when explicitly hitting
the 'settings' button to dismiss the menu. But clicking anywhere outside
the menu dismisses it.
2023-12-01 19:55:51 -08:00
Kartik K. Agaram d98bc8cc7d lay out buttons based on device dimensions 2023-11-22 12:38:16 -08:00
Kartik K. Agaram fc3cb96171 support event handlers
I've agonized over conflicts between editor and script handlers for a
while, but finally the solution occurred to me: to use the script's
handlers, hide the editor. To use the editor's handlers, show the
editor. The menu and settings are always active. This seems nice and
consistent, easy to explain.

Mike Stein would prefer we just supported love.* handlers in scripts to
minimize special cases and cognitive load for people. But I'd rather
err on the side of being transparent about what's going on inside. As a
compromise I'm supporting love.* names at least in addition to my
rephrasings (which came about mostly because love.keychordpressed is
just too much of a mouthful)
2023-11-21 19:17:49 -08:00
Kartik K. Agaram 76bfcba47e sliders for font size and color settings 2023-11-21 02:19:56 -08:00
Kartik K. Agaram 6baf99a0dc pop keyboard back up on touchscreens 2023-11-19 19:26:01 -08:00
Kartik K. Agaram e38191fc4f aggregate global state inside a 'pane' object
We're soon going to start juggling multiple of these.
2023-11-19 13:15:06 -08:00
Kartik K. Agaram 809a980213 implement second, 'output' editor
Also its scrollbar.
2023-11-18 21:18:09 -08:00
Kartik K. Agaram 065da8de04 send editor clicks to the left of the scrollbar 2023-11-18 06:03:57 -08:00
Kartik K. Agaram fe8a21bea3 mouse events for scrollbar
You can either drag the scrollbar or click anywhere in the scrollbar
area.

It has this weird funkiness that the scrollbar shrinks as you get near
the bottom. But it feels.. weirdly satisfying?
2023-11-18 05:29:07 -08:00
Kartik K. Agaram 28f1e113a4 start of the visual skeleton 2023-11-15 07:04:34 -08:00
Kartik K. Agaram 01a8e0bb9f new fork: carousel shell 2023-11-15 06:06:56 -08:00