Commit Graph

12 Commits

Author SHA1 Message Date
Kartik K. Agaram 27733025a2 up and down arrow working at all 3 zoom levels
I don't know why I have such an almighty struggle with this stuff.
2023-10-27 17:13:28 -07:00
Kartik K. Agaram 8d9af77ab1 clean up all the mess since commit fe4e1395d0
In the process we find a new bug. Scrolling with keyboard is overly
eager to clamp screen_top to bottom of screen when the top used to be
within the viewport.

Until recently, scrolling past the bottom when the margin was visible
would move the cursor correctly but pan the surface to the top of the
viewport. Slightly jarring, but good enough.
2023-10-25 17:59:38 -07:00
Kartik K. Agaram ed08869d25 fix a stupid mistake
Everything seems to be working now!
2023-10-25 17:48:00 -07:00
Kartik K. Agaram e10ac63be5 snapshot: insight
Ugh, it's been in front of my eyes all along. The logs have been
repeatedly showing a recurrence within a single frame:

key press -> update Viewport.y from screen_top -> A -> B -> update_editor_box -> update screen_top from Viewport.y

We need both those updates, but both should never occur at the same
time to the same node.

I think this is why screen panning works if I take out the scale inside
update_editor_box: the scale has already happened "once" in
updating Viewport.y, and it doesn't converge if we perform it a second
time in a frame. But the solution is just to do one or the other to a
node, never both.

I knew this (learned it the hard way) when I first built pensieve.love,
and I had an assertion to avoid it. But my assertion was brittle, and it
kept failing, and I took it out, and then I slowly took out all the code
that prevented this recurrence.
2023-10-25 16:14:08 -07:00
Kartik K. Agaram 03c4f86ccd snapshot: commit 0ca5bb0e8d, take 2
Panning with a cursor inside a node is working fine.
The relationship between y_of_schema1 and schema1_of_y is preserved.
I understand why I shouldn't scale the y in the call to schema1_of_y.

I'm also feeling a little more confident about why lines.love shouldn't
use coordinate transforms. The problem is that text gets blurry if it
starts at non-integer coordinates. We're forced to get into special
cases.

There's still the outstanding issue that the surface y coordinate of
each screen line is not consistent as you pan around (and the editor
starts off-screen above the viewport).

If you have just text boxes it's only noticeable when one box's top
margin is visible and another is not. Then the text in the two moves
relative to each other.
2023-10-25 09:30:50 -07:00
Kartik K. Agaram 7eb1c6d7e0 better setup for manual tests 2023-10-25 09:29:25 -07:00
Kartik K. Agaram d0dffb4d00 undo 2 most recent commits 2023-10-25 09:29:22 -07:00
Kartik K. Agaram f54e1ad064 abort: switch to LÖVE's coordinate transforms
This is a big change, and I'd have to first modify lines.love to use the
coordinate transforms. And that fork doesn't really need a principled
coordinate system.
2023-10-25 09:28:14 -07:00
Kartik K. Agaram c2f765489a commit 0ca5bb0e8d did indeed cause the regression
Unscaled y makes cursor scrolling more stable, but it seems to be
compensating for an error elsewhere. The location of the top margin of
text is not stable, and I only notice when I can see the bottom margin
of the bounding box. (When the top margin is visible we never enter that
branch in update_editor_box.)

I should just use LÖVE's standard translation and scaling transforms for
the surface! Don't know why I didn't think of that.
2023-10-25 09:27:45 -07:00
Kartik K. Agaram 8a95025036 borders around editor nodes 2023-06-20 21:58:15 -07:00
Kartik K. Agaram b138f1ff9b Merge template-live-editor 2023-04-16 11:30:56 -07:00
Kartik K. Agaram 4f62ea1f8c render hierarchies of rows and columns of text
We can't edit any text yet.
2022-12-17 12:41:00 -08:00