From 03c4f86ccd397b00eb8bd81aa0a75cee8accffa4 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 25 Oct 2023 09:23:05 -0700 Subject: [PATCH] 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. --- 0011-box_height | 2 +- 0020-Page | 91 ++++++++++++++++++++++++++++-------------- 0026-on.draw | 2 +- 0029-Page2 | 64 ++++++++++++++++++++++++++++- 0030-update_editor_box | 1 + 5 files changed, 126 insertions(+), 34 deletions(-) diff --git a/0011-box_height b/0011-box_height index 794a812..15c6b38 100644 --- a/0011-box_height +++ b/0011-box_height @@ -12,5 +12,5 @@ box_height = function(node) y = y + node.editor.line_height*#node.editor.line_cache[i].screen_line_starting_pos Text.clear_screen_line_cache(node.editor, i) end - return y + return y/Viewport.zoom end diff --git a/0020-Page b/0020-Page index 33c7966..767b025 100644 --- a/0020-Page +++ b/0020-Page @@ -9,37 +9,68 @@ Page = { doc='prose goes here, on the left half of the window', margin=Margin_left, data={ - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", - '1', - '2', - '3', - 'mno', - 'Acb', - 'g', - 'hij', - 'klm', - 'nop', +'1', +'2', +'3', +'4', +'5', +'6', +'7', +'8', +'9', +'10', +'11', +'12', +'13', +'14', +'15', +'16', +'17', +'18', +'19', +'20', +'21', +'22', +'23', +'24', +'25', +'26', +'27', +'28', +'29', +'30', +'31', +'32', +'33', +'34', +'35', +'36', +'37', +'38', +'39', +'40', +'41', +'42', +'43', +'44', +'45', +'46', +'47', +'48', +'49', +'50', +'51', +'52', +'53', +'54', +'55', +'56', +'57', +'58', +'59', +'60', }, width=400, bg={r=1,g=1,b=0} }, - -- a table on the right - { type='rows', name='searches', margin=50, data={ - { type='text', data={''},}, - { type='cols', data={ - { type='text', data={'search:'},}, - { type='text', name='search', bg={r=0.8,g=0.8,b=0.8}, data={''}, width=90,}, - }}, - { type='text', data={'table:'},}, - { type='cols', bg={r=0.8,g=0.8,b=0.8}, data={ - { type='rows', width=90, data={ - {type='text', data={'abc'},}, - {type='text', data={'abc'},}, - }}, - { type='rows', width=90, data={ - {type='text', data={'def'},}, - {type='text', data={'def'},}, - }}, - }}, - }}, }, -} \ No newline at end of file +} diff --git a/0026-on.draw b/0026-on.draw index 40433f2..38ecf9f 100644 --- a/0026-on.draw +++ b/0026-on.draw @@ -3,7 +3,7 @@ on.draw = function() love.graphics.line(vx(0), vy(0), vx(0), vy(1000000)) love.graphics.line(vx(0), vy(0), vx(1000000), vy(0)) for i=0,100 do - love.graphics.print(tostring(i), vx(0), vy(i*1000)) + love.graphics.print(tostring(i), vx(0), vy(i*100)) end for _,obj in ipairs(Surface) do love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0) diff --git a/0029-Page2 b/0029-Page2 index 61735e5..2d19f26 100644 --- a/0029-Page2 +++ b/0029-Page2 @@ -3,7 +3,67 @@ Page2 = { -- page type='text', data={ -"Call me Ishmael. Some years ago--never mind how long precisely--having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people's hats off--then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me." +'1', +'2', +'3', +'4', +'5', +'6', +'7', +'8', +'9', +'10', +'11', +'12', +'13', +'14', +'15', +'16', +'17', +'18', +'19', +'20', +'21', +'22', +'23', +'24', +'25', +'26', +'27', +'28', +'29', +'30', +'31', +'32', +'33', +'34', +'35', +'36', +'37', +'38', +'39', +'40', +'41', +'42', +'43', +'44', +'45', +'46', +'47', +'48', +'49', +'50', +'51', +'52', +'53', +'54', +'55', +'56', +'57', +'58', +'59', +'60', + }, width=400, bg={r=0,g=0.8,b=0} -} \ No newline at end of file +} diff --git a/0030-update_editor_box b/0030-update_editor_box index 5808946..33aa595 100644 --- a/0030-update_editor_box +++ b/0030-update_editor_box @@ -8,6 +8,7 @@ update_editor_box = function(node) node.editor.top = vy(node.y) else node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y-node.y) + print('update', Viewport.y-node.y+node.editor.top - y_of_schema1(node.editor, node.editor.screen_top1)) end node.editor.left = math.floor(vx(node.x)) node.editor.right = math.ceil(vx(node.x+node.w))