Commit Graph

1580 Commits

Author SHA1 Message Date
Kartik K. Agaram 0862dd2f72 Merge template-live-editor-mobile 2023-12-01 22:26:00 -08:00
Kartik K. Agaram b0c73e3d25 Merge template-live-editor 2023-12-01 22:25:00 -08:00
Kartik K. Agaram 7bbc10fffb Merge text0 2023-12-01 22:24:42 -08:00
Kartik K. Agaram 5a2581bf71 Merge text.love 2023-12-01 22:24:03 -08:00
Kartik K. Agaram 52ffb40d79 Merge lines.love 2023-12-01 22:17:43 -08:00
Kartik K. Agaram 8399c42707 mouse button state in source editor 2023-12-01 22:07:24 -08:00
Kartik K. Agaram 120f4ccf1b Merge text.love 2023-12-01 22:06:34 -08:00
Kartik K. Agaram 61336b491b Merge lines.love 2023-12-01 22:03:36 -08:00
Kartik K. Agaram 8a588880b7 manually maintain mouse button press state
Just checking mouse.isDown works if the editor is the entirety of the
app, as is true in this fork. However, we often want to introduce other
widgets. We'd like tapping on them to not cause the selection to flash:
  https://news.ycombinator.com/context?id=38404923&submission=38397715

The right architecture to enforce this is: have each layer of the UI
maintain its own state machine between mouse_press and mouse_release
events. And only check the state machine in the next level down rather
than lower layers or the bottommost layer of raw LÖVE.
2023-12-01 21:56:35 -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 e0a0c4f33b check slider state more precisely 2023-12-01 20:53:08 -08:00
Kartik K. Agaram 9b62cf0afc no selection if State didn't receive mouse_press
This change needs to get backported to all the other forks. We want to
retain the ability to draw other UI elements in our apps, and that means
we can't always assume that a mouse press and mouse release will happen
together. Instead, each layer should manage its own state machine, and
only check for events from the immediately lower layer.

This idea generalizes commit c3cdbb52a.
2023-12-01 20:46:45 -08:00
Kartik K. Agaram c3cdbb52a9 set cursor on mouse_press as well as mouse_release
Problem: on mobile devices, tapping on the editor causes the selection
to flash for a second. It looks like there's a longer time between mouse
press and release events.

Scenarios tested with this change:
* click on the editor to move the cursor
* drag-select using the mouse
* shift-select using keyboard
* shift-click to select
2023-12-01 20:26:21 -08:00
Kartik K. Agaram a3fdbaad6d support undo of paste button 2023-12-01 20:22:27 -08:00
Kartik K. Agaram 2ff2692bb4 bugfix: use border color in scrollbars 2023-12-01 20:19:27 -08:00
Kartik K. Agaram 230b903df8 avoid the overflow button in some narrow cases 2023-12-01 20:15:46 -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 d85c246cfb bugfix: avoid overflowing 'delete' button in some situations 2023-12-01 19:59:23 -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 5875196422 bugfix: hit 'clear' with text selected
Before this commit, selecting some text and then hitting the 'clear'
button would crash the app.
2023-12-01 19:53:14 -08:00
Kartik K. Agaram 750ef9d54d remove warning about persistence from Readme 2023-11-26 13:39:26 -08:00
Kartik K. Agaram f53b5d4b8f more minor tweaks to examples 2023-11-26 12:54:34 -08:00
Kartik K. Agaram f7ba3b93da brief note about the 'save' button 2023-11-26 12:53:11 -08:00
Kartik K. Agaram f8f6cbf37d clarify wording on a couple of examples
Thanks Mike Stein.
2023-11-26 12:34:22 -08:00
Kartik K. Agaram 2c3cc40aa7 position recent definitions on default map 2023-11-26 12:29:13 -08:00
Kartik K. Agaram f3965c61e8 save the list of open files across restart 2023-11-26 12:26:22 -08:00
Kartik K. Agaram 6aa19f1086 bugfix: crash when saving to empty file
Thanks Rebecca Allard for catching this.
2023-11-26 10:51:15 -08:00
Kartik K. Agaram 99df5b8b1a bugfix: bring output border up to date 2023-11-26 10:33:22 -08:00
Kartik K. Agaram 07b4fce750 ok/cancel buttons in file dialog 2023-11-26 10:21:42 -08:00
Kartik K. Agaram d71e7fcfc8 extract a function 2023-11-26 09:53:09 -08:00
Kartik K. Agaram f1ddd6b8da hoist a temporary inside a function 2023-11-26 09:49:54 -08:00
Kartik K. Agaram cbe2f51382 delete dead code 2023-11-26 09:36:10 -08:00
Kartik K. Agaram dc4cf14d28 make it look more like a dialog 2023-11-26 09:21:09 -08:00
Kartik K. Agaram b517a75eb9 filter file list based on input 2023-11-26 09:14:55 -08:00
Kartik K. Agaram 14f13471fd bugfix: reset some more state 2023-11-26 09:10:03 -08:00
Kartik K. Agaram 3c56c2133d reset file system state with everything else 2023-11-26 09:09:32 -08:00
Kartik K. Agaram daf75130d4 bugfix: skipping files near right margin 2023-11-26 09:04:42 -08:00
Kartik K. Agaram 1b898d4a2e type out a filename to load/save 2023-11-26 08:52:34 -08:00
Kartik K. Agaram 83ebcaa5c4 first draft of load/save buttons
Some considerations in the design so far:
* Desired flows:
  * start typing into a new pane, then save to a filename
  * load from a filename, then continue typing/running
  * save as a second file

* Should we autosave? I think not yet, because my editor's undo/redo
  functionality is not accessible yet on mobile. Android devices can't
  press 'ctrl', and the hotkeys aren't very discoverable.

  (I considered menu options for 'undo' and 'redo', but they won't be
  very ergonomic because my undo/redo functionality is primitive and
  doesn't support grouping similar operations. Now you're stuck tapping
  '>>', then 'undo' and losing one character. Then the menu closes and
  you have to do it all over again.)

  Another knock against autosave on mobile: autosave on quit is
  unreliable. At least on my Android devices, LÖVE doesn't trigger
  love.quit when you swipe away an app. iOS of course has no such notion
  in the first place.

* Menu buttons take up space, and I'm loath to expend 2 more buttons.
  However, I don't see a good alternative:

  * We can't use a single button to bind a filename to a pane until we
    get autosave.

  * Save on run? It doesn't save a button, but maybe we can keep 'save'
    up top because we'll want to keep hitting it in the absence of
    autosave. However, I don't want to lose data just because I started
    typing out a long program that never got to a runnable point.

* I'd like to keep 'save' always up. But newcomers might have more
  trouble finding things if load and save are separated from each other.
  Seems like the sort of thing Mike complained about before the current
  button organization.

==> conclusion: no autosave, 2 buttons, load and save

* I want to follow MiniIDE and only save to a single directory (no
  subdirectories, even). Simplifies the file dialog.

* Where should this directory live? Source base risks growing really
  large and unwieldy over time as we share files between lots of LÖVE
  apps. At least, Mike has that problem. Save dir is utterly
  inaccessible to other apps -- including later versions of this one.
  Once you delete one version of an app (say before installing a new
  version) the only way to find your files is to wade through lots of
  cryptic directories inside source dir. And you'd need a new LÖVE app
  to do that.

==> conclusion: save to a fixed subdir of source base dir. That way only
Lua Carousel will save there, but different versions share a common
space.

* Should examples be savable? If yes, we could have conflicts. If no,
  it feels like a gotcha when someone starts editing an example.

==> conclusion: allow examples to be saved, but that creates a new copy
of them on restart. It'll be weird that the order changes, but seems
like the best option.

* Where to show the current filename? I don't want to further reduce
  space for buttons. A smaller font seems necessary here to squeeze the
  filename into an interstitial of the UI.

Still to do: providing a non-existing file to load/save. I plan a
command palette UI for filtering or selecting a new file.
2023-11-25 23:40:28 -08:00
Kartik K. Agaram 54ef90bca7 extract a second helper for buttons 2023-11-25 23:03:36 -08:00
Kartik K. Agaram 3e17033a87 extract a helper for buttons 2023-11-25 21:11:24 -08:00
Kartik K. Agaram 28d450563e delete some old code 2023-11-25 19:07:06 -08:00
Kartik K. Agaram dbfa07f059 bugfix: code overflowing lower border after resize 2023-11-25 18:59:25 -08:00
Kartik K. Agaram 0c8722ac7f bugfix: save settings on mobile devices 2023-11-25 18:29:32 -08:00
Kartik K. Agaram 950f836e0b Merge template-live-editor-mobile 2023-11-25 16:12:16 -08:00
Kartik K. Agaram cc10e9c211 Merge template-live-editor 2023-11-25 16:10:39 -08:00
Kartik K. Agaram 7fa185dc99 Merge text0 2023-11-25 16:10:10 -08:00
Kartik K. Agaram a143125743 Merge text.love 2023-11-25 16:09:24 -08:00
Kartik K. Agaram 01c0b8e847 Merge lines.love 2023-11-25 16:01:29 -08:00