pothi.love/0074-initialize_editor

9 lines
343 B
Plaintext

initialize_editor = function(obj)
if obj.w then
-- use an editor to wrap the text
local scaled_fontsize = scale(obj.fontsize or 20)
obj.editor = edit.initialize_state(vy(obj.y), vx(obj.x), vx(obj.x+obj.w), scaled_fontsize, math.floor(scaled_fontsize*1.3))
obj.editor.lines = load_array(obj.data)
Text.redraw_all(obj.editor)
end
end