revert commit 4c8960b5c7
Well, almost. I'm just reminding myself of the sort of plumbing I need, not reintroducing the old logic that never worked right and had undergone n iterations of corruption.
This commit is contained in:
parent
e10ac63be5
commit
0a37b1b80c
6
0019-B
6
0019-B
|
@ -1,4 +1,4 @@
|
|||
B = function()
|
||||
B = function(preserve_screen_top_of_cursor_node)
|
||||
-- recompute various aspects based on the current viewport settings
|
||||
for _,obj in ipairs(Surface) do
|
||||
if obj.type == 'line' then
|
||||
|
@ -16,10 +16,10 @@ B = function()
|
|||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
if obj.w then
|
||||
update_editor_box(obj)
|
||||
update_editor_box(obj, preserve_screen_top_of_cursor_node)
|
||||
else
|
||||
obj.text = love.graphics.newText(love.graphics.getFont(), obj.data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
compute_layout = function(node, x,y, nodes_to_render)
|
||||
compute_layout = function(node, x,y, nodes_to_render, preserve_screen_top_of_cursor_node)
|
||||
-- append to nodes_to_render flattened instructions to render a hierarchy of nodes
|
||||
-- return x,y rendered until (surface coordinates)
|
||||
if node.type == 'text' then
|
||||
|
@ -31,7 +31,7 @@ compute_layout = function(node, x,y, nodes_to_render)
|
|||
if node.editor == nil then
|
||||
initialize_editor(node)
|
||||
else
|
||||
update_editor_box(node)
|
||||
update_editor_box(node, preserve_screen_top_of_cursor_node)
|
||||
end
|
||||
node.h = box_height(node)
|
||||
table.insert(nodes_to_render, node)
|
||||
|
|
|
@ -5,6 +5,6 @@ on.text_input = function(t)
|
|||
if not eq(Cursor_node.editor.screen_top1, old_top) then
|
||||
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
|
||||
end
|
||||
A()
|
||||
A(--[[preserve screen_top of cursor node]] true)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -22,7 +22,7 @@ on.keychord_press = function(chord, key)
|
|||
if not eq(Cursor_node.editor.screen_top1, old_top) then
|
||||
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
|
||||
end
|
||||
A()
|
||||
A(--[[preserve screen_top of cursor node]] true)
|
||||
else
|
||||
if chord == 'up' then
|
||||
Viewport.y = Viewport.y - scale(20)
|
||||
|
|
6
0028-A
6
0028-A
|
@ -1,8 +1,8 @@
|
|||
A = function()
|
||||
A = function(preserve_screen_top_of_cursor_node)
|
||||
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font
|
||||
Surface = {}
|
||||
compute_layout(Page, Page.x,Page.y, Surface)
|
||||
-- continue the pipeline
|
||||
B()
|
||||
B(preserve_screen_top_of_cursor_node)
|
||||
-- TODO: ugly that we're manipulating editor objects twice
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
update_editor_box = function(node)
|
||||
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
|
||||
if node.editor == nil then return end
|
||||
edit.update_font_settings(node.editor, scale(20))
|
||||
if node.y > Viewport.y then
|
||||
|
@ -14,4 +14,4 @@ update_editor_box = function(node)
|
|||
node.editor.right = math.ceil(vx(node.x+node.w))
|
||||
node.editor.width = node.editor.right - node.editor.left
|
||||
Text.redraw_all(node.editor)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue