pothi.love/0030-update_editor_box

23 lines
943 B
Plaintext
Raw Normal View History

update_editor_box = function(node, skip_updating_screen_top_for)
2022-12-26 00:56:47 +00:00
if node.editor == nil then return end
print('update box', node, node.editor.screen_top1.line, skip_updating_screen_top_for)
edit.update_font_settings(node.editor, scale(20))
if node ~= skip_updating_screen_top_for then
print('update box: refreshing screen top', node.editor.screen_top1.line)
if node.y > Viewport.y then
2022-12-26 00:56:47 +00:00
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, scale(Viewport.y-node.y))
2022-12-26 00:56:47 +00:00
end
else
print('update box: NOT refreshing screen top', node.editor.screen_top1.line)
end
2022-12-26 00:56:47 +00:00
node.editor.left = math.floor(vx(node.x))
node.editor.right = math.ceil(vx(node.x+node.w))
node.editor.width = node.editor.right - node.editor.left
2022-12-26 00:56:47 +00:00
Text.redraw_all(node.editor)
print('end update box', node, skip_updating_screen_top_for)
end