snap.love/0011-box_height

17 lines
653 B
Plaintext
Raw Normal View History

box_height = function(node)
-- return the height of a text editor node (explicit width). The result is scaled.
local count = 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].screen_line_starting_pos = nil
Text.populate_screen_line_starting_pos(node.editor, i)
count = count + #node.editor.line_cache[i].screen_line_starting_pos
Text.clear_screen_line_cache(node.editor, i)
end
print(count, '*', node.editor.line_height, '=', count*node.editor.line_height)
return count*node.editor.line_height/Viewport.zoom
2023-04-03 01:05:54 +01:00
end