pothi.love/0269-box_height

16 lines
625 B
Plaintext

box_height = function(node)
local y = 0
for i=1,#node.editor.lines do
local line = node.editor.lines[i]
if node.editor.line_cache[i] == nil then
node.editor.line_cache[i] = {}
end
node.editor.line_cache[i].fragments = nil
node.editor.line_cache[i].screen_line_starting_pos = nil
Text.compute_fragments(node.editor, i)
Text.populate_screen_line_starting_pos(node.editor, i)
-- y = y + node.scaled_fontsize*#node.editor.line_cache[i].screen_line_starting_pos
y = y + math.floor(scale(node.editor.line_height))*#node.editor.line_cache[i].screen_line_starting_pos
end
return y
end