Scenario I was seeing:
* on an Android phone
* when font size is small
* if I scrolled down a bit
* and then tapped on the editor
Then before this commit, the scrollbar would move. Even though I was
tapping nowhere near the scrollbar. Or even the settings area!
I carefully bisected this down to commit 7ca2006145 and this code in
on.mouse_release:
if on_area(Settings_menu_area, x,y) then
return
end
What was actually going on in the above scenario:
* on a device with a small screen
* after I open the settings menu once
* the scrollbar overlaps the erstwhile setting menu, so that dragging
the scrollbar doesn't trigger on.mouse_receive
* as a result the scrollbar is still active when I tap the editor.
Holy smokes!
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.
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)
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?