There's one major issue: the initial load has incorrect box heights. I have to connect with the driver before things look right.
25UHVUGNT3ANOGCQLL6GG6NNV4SLWLAMPME45JHWLLC2KK4GJO2QC
on.code_change = function()
print('code changed')
A(Input_filename) -- just in case we edited something
end
{"font":353,"add_thick_line":400,"compute_ntracks":519,"Cursor_node":172,"Input_filename":436,"on.text_input":388,"ntracks":505,"box_height":345,"Surface":434,"compute_layout":385,"line_height":365,"on.code_change":578,"dehtml":456,"Viewport":303,"schema1_of_y":366,"add_node":576,"initialize_editor":338,"on.initialize":446,"to_text":180,"A":474,"load_from_iterator":463,"B":379,"fw_parent":577,"on.draw":418,"fw_app":"mastodon-luaML","on.mouse_press":179,"render_node_and_descendants":577,"scale":7,"vx":5,"y_of_schema1":364,"split_lines":469,"vy":8,"copy_shape":396,"add_edge":575,"render_thread_to_surface":571,"on":1,"on.mouse_release":367,"update_editor_box":430,"on.update":368,"on.keychord_press":391}
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent_surface_node)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil then
add_node(xlo, y, parent.content, grandparent_surface_node)
return
end
local parent_xlo
if #parent.children <= 1 then
parent_xlo = xlo
else
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
parent_xlo = parent_x - 620/2
end
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent_surface_node)
local parent_height = box_height(parent_surface_node)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + parent_height + 50, curr_boundary, curr_boundary + 620*child.ntracks, parent_surface_node)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"font":353,"add_thick_line":400,"compute_ntracks":519,"Cursor_node":172,"Input_filename":436,"on.text_input":388,"ntracks":505,"box_height":345,"Surface":434,"compute_layout":385,"line_height":365,"on.code_change":473,"dehtml":456,"Viewport":303,"schema1_of_y":366,"add_node":576,"initialize_editor":338,"on.initialize":446,"to_text":180,"A":474,"load_from_iterator":463,"B":379,"fw_parent":576,"on.draw":418,"fw_app":"mastodon-luaML","on.mouse_press":179,"render_node_and_descendants":577,"scale":7,"vx":5,"y_of_schema1":364,"split_lines":469,"vy":8,"copy_shape":396,"add_edge":575,"render_thread_to_surface":571,"on":1,"on.mouse_release":367,"update_editor_box":430,"on.update":368,"on.keychord_press":391}
{"font":353,"add_thick_line":400,"compute_ntracks":519,"Cursor_node":172,"Input_filename":436,"on.text_input":388,"ntracks":505,"box_height":345,"Surface":434,"compute_layout":385,"line_height":365,"on.code_change":473,"dehtml":456,"Viewport":303,"schema1_of_y":366,"add_node":576,"initialize_editor":338,"on.initialize":446,"to_text":180,"A":474,"load_from_iterator":463,"B":379,"fw_parent":575,"on.draw":418,"fw_app":"mastodon-luaML","on.mouse_press":179,"render_node_and_descendants":565,"scale":7,"vx":5,"y_of_schema1":364,"split_lines":469,"vy":8,"copy_shape":396,"add_edge":575,"render_thread_to_surface":571,"on":1,"on.mouse_release":367,"update_editor_box":430,"on.update":368,"on.keychord_press":391}
add_node = function(x, y, text, parent_surface_node)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent_surface_node then
add_edge(surface_node, parent_surface_node)
end
return surface_node
end
{"font":353,"add_thick_line":400,"compute_ntracks":519,"Cursor_node":172,"Input_filename":436,"on.text_input":388,"ntracks":505,"box_height":345,"Surface":434,"compute_layout":385,"line_height":365,"on.code_change":473,"dehtml":456,"Viewport":303,"schema1_of_y":366,"add_node":574,"initialize_editor":338,"on.initialize":446,"to_text":180,"A":474,"load_from_iterator":463,"B":379,"fw_parent":574,"on.draw":418,"fw_app":"mastodon-luaML","on.mouse_press":179,"render_node_and_descendants":565,"scale":7,"vx":5,"y_of_schema1":364,"split_lines":469,"vy":8,"copy_shape":396,"add_edge":575,"render_thread_to_surface":571,"on":1,"on.mouse_release":367,"update_editor_box":430,"on.update":368,"on.keychord_press":391}
add_edge = function(node, parent)
local line = {
type='line',
data={
parent.x + 600/2, parent.y + box_height(parent),
node.x + 600/2, node.y,
},
}
table.insert(Surface, line)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":571,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":573,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":574,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":573,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent_surface_node)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent_surface_node then -- and N_edges > 0 then
add_edge(surface_node, parent_surface_node)
N_edges = N_edges - 1
end
return surface_node
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":571,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":572,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":568,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":573,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_edge = function(node, parent)
print('add edge', node.x, node.y, parent.x, parent.y)
local line = {
type='line',
data={
parent.x + 600/2, parent.y + box_height(parent),
node.x + 600/2, node.y,
},
}
print('add edge 2', line.data[2], line.data[4])
table.insert(Surface, line)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":571,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":571,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":568,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":572,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_edge = function(node, parent)
print('add edge', node.x, node.y, parent.x, parent.y)
local line = {
type='line',
data={
parent.x + 600/2, parent.y + box_height(node),
node.x + 600/2, node.y,
},
}
print('add edge 2', line.data[2], line.data[4])
table.insert(Surface, line)
end
render_thread_to_surface = function(thread_data)
-- design constraints:
-- trees only, no graphs or DAGs
-- parents above children
-- a child shares its parent's column exactly only if it's an only child
-- parents can overlap columns with children and more distant descendants
-- siblings never share a column
-- siblings never overlap columns
-- siblings always occupy the same row
-- cousins/aunts/nephews never overlap columns
Surface = {}
-- compute mapping from ids to nodes
local nodes = {} -- id to object
nodes[thread_data.id] = thread_data
for _,x in ipairs(thread_data.descendants) do
nodes[x.id] = x
end
local root = thread_data
-- compute children
for _,x in pairs(nodes) do
parent_id = x.in_reply_to_id
if x.id ~= root.id then
assert(parent_id)
local parent = nodes[parent_id]
if parent.children == nil then
parent.children = {}
end
table.insert(parent.children, x.id)
end
end
-- sort children by time
for _,x in pairs(nodes) do
if x.children then
table.sort(x.children)
end
end
-- compute number of tracks needed
for _,x in pairs(nodes) do
if x.ntracks == nil then
x.ntracks = compute_ntracks(nodes, x)
end
end
-- prepare the tracks
-- each track is 600px + 20px of gutter between nodes
N_edges = 2
render_node_and_descendants(nodes, root.id, --[[y]] 0, --[[xlo]] 0, --[[xhi]] 620 * root.ntracks)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":571,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":570,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":568,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
render_thread_to_surface = function(thread_data)
-- design constraints:
-- trees only, no graphs or DAGs
-- parents above children
-- a child shares its parent's column exactly only if it's an only child
-- parents can overlap columns with children and more distant descendants
-- siblings never share a column
-- siblings never overlap columns
-- siblings always occupy the same row
-- cousins/aunts/nephews never overlap columns
Surface = {}
-- compute mapping from ids to nodes
local nodes = {} -- id to object
nodes[thread_data.id] = thread_data
for _,x in ipairs(thread_data.descendants) do
nodes[x.id] = x
end
local root = thread_data
-- compute children
for _,x in pairs(nodes) do
parent_id = x.in_reply_to_id
if x.id ~= root.id then
assert(parent_id)
local parent = nodes[parent_id]
if parent.children == nil then
parent.children = {}
end
table.insert(parent.children, x.id)
end
end
-- sort children by time
for _,x in pairs(nodes) do
if x.children then
table.sort(x.children)
end
end
-- compute number of tracks needed
for _,x in pairs(nodes) do
if x.ntracks == nil then
x.ntracks = compute_ntracks(nodes, x)
end
end
-- prepare the tracks
-- each track is 600px + 20px of gutter between nodes
N_edges = 1
render_node_and_descendants(nodes, root.id, --[[y]] 0, --[[xlo]] 0, --[[xhi]] 620 * root.ntracks)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":570,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":569,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":568,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
render_thread_to_surface = function(thread_data)
-- design constraints:
-- trees only, no graphs or DAGs
-- parents above children
-- a child shares its parent's column exactly only if it's an only child
-- parents can overlap columns with children and more distant descendants
-- siblings never share a column
-- siblings never overlap columns
-- siblings always occupy the same row
-- cousins/aunts/nephews never overlap columns
Surface = {}
-- compute mapping from ids to nodes
local nodes = {} -- id to object
nodes[thread_data.id] = thread_data
for _,x in ipairs(thread_data.descendants) do
nodes[x.id] = x
end
local root = thread_data
-- compute children
for _,x in pairs(nodes) do
parent_id = x.in_reply_to_id
if x.id ~= root.id then
assert(parent_id)
local parent = nodes[parent_id]
if parent.children == nil then
parent.children = {}
end
table.insert(parent.children, x.id)
end
end
-- sort children by time
for _,x in pairs(nodes) do
if x.children then
table.sort(x.children)
end
end
-- compute number of tracks needed
for _,x in pairs(nodes) do
if x.ntracks == nil then
x.ntracks = compute_ntracks(nodes, x)
end
end
-- prepare the tracks
-- each track is 600px + 20px of gutter between nodes
N_edges = 2
render_node_and_descendants(nodes, root.id, --[[y]] 0, --[[xlo]] 0, --[[xhi]] 620 * root.ntracks)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":569,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":568,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":568,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":567,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":567,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":568,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent_surface_node)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent_surface_node and N_edges > 0 then
add_edge(surface_node, parent_surface_node)
N_edges = N_edges - 1
end
return surface_node
end
render_thread_to_surface = function(thread_data)
-- design constraints:
-- trees only, no graphs or DAGs
-- parents above children
-- a child shares its parent's column exactly only if it's an only child
-- parents can overlap columns with children and more distant descendants
-- siblings never share a column
-- siblings never overlap columns
-- siblings always occupy the same row
-- cousins/aunts/nephews never overlap columns
Surface = {}
-- compute mapping from ids to nodes
local nodes = {} -- id to object
nodes[thread_data.id] = thread_data
for _,x in ipairs(thread_data.descendants) do
nodes[x.id] = x
end
local root = thread_data
-- compute children
for _,x in pairs(nodes) do
parent_id = x.in_reply_to_id
if x.id ~= root.id then
assert(parent_id)
local parent = nodes[parent_id]
if parent.children == nil then
parent.children = {}
end
table.insert(parent.children, x.id)
end
end
-- sort children by time
for _,x in pairs(nodes) do
if x.children then
table.sort(x.children)
end
end
-- compute number of tracks needed
for _,x in pairs(nodes) do
if x.ntracks == nil then
x.ntracks = compute_ntracks(nodes, x)
end
end
-- prepare the tracks
-- each track is 600px + 20px of gutter between nodes
N_edges = 1
render_node_and_descendants(nodes, root.id, --[[y]] 0, --[[xlo]] 0, --[[xhi]] 620 * root.ntracks)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":567,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":566,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":563,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
render_thread_to_surface = function(thread_data)
-- design constraints:
-- trees only, no graphs or DAGs
-- parents above children
-- a child shares its parent's column exactly only if it's an only child
-- parents can overlap columns with children and more distant descendants
-- siblings never share a column
-- siblings never overlap columns
-- siblings always occupy the same row
-- cousins/aunts/nephews never overlap columns
Surface = {}
-- compute mapping from ids to nodes
local nodes = {} -- id to object
nodes[thread_data.id] = thread_data
for _,x in ipairs(thread_data.descendants) do
nodes[x.id] = x
end
local root = thread_data
-- compute children
for _,x in pairs(nodes) do
parent_id = x.in_reply_to_id
if x.id ~= root.id then
assert(parent_id)
local parent = nodes[parent_id]
if parent.children == nil then
parent.children = {}
end
table.insert(parent.children, x.id)
end
end
-- sort children by time
for _,x in pairs(nodes) do
if x.children then
table.sort(x.children)
end
end
-- compute number of tracks needed
for _,x in pairs(nodes) do
if x.ntracks == nil then
x.ntracks = compute_ntracks(nodes, x)
end
end
-- prepare the tracks
-- each track is 600px + 20px of gutter between nodes
render_node_and_descendants(nodes, root.id, --[[y]] 0, --[[xlo]] 0, --[[xhi]] 620 * root.ntracks)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":566,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":565,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":563,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent_surface_node)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil then
add_node(xlo, y, parent.content, grandparent_surface_node)
return
end
local parent_xlo
if #parent.children <= 1 then
parent_xlo = xlo
else
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
parent_xlo = parent_x - 620/2
end
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent_surface_node)
local parent_height = box_height(parent_surface_node)
print(id, parent_height)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + parent_height + 50, curr_boundary, curr_boundary + 620*child.ntracks, parent_surface_node)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":564,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":563,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":565,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent_surface_node)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
print(id)
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil then
add_node(xlo, y, parent.content, grandparent_surface_node)
return
end
local parent_xlo
if #parent.children <= 1 then
parent_xlo = xlo
else
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
parent_xlo = parent_x - 620/2
end
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent_surface_node)
local parent_height = box_height(parent_surface_node)
print(id, parent_height)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + parent_height + 50, curr_boundary, curr_boundary + 620*child.ntracks, parent_surface_node)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":563,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":563,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":564,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":562,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":563,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":562,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent_surface_node)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent_surface_node then
add_edge(surface_node, parent_surface_node)
end
return surface_node
end
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent_surface_node)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
print(id)
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil then
add_node(xlo, y, parent.content, grandparent_surface_node)
return
end
local parent_xlo
if #parent.children <= 1 then
parent_xlo = xlo
else
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
parent_xlo = parent_x - 620/2
end
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent_surface_node)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + box_height(parent_surface_node) + 50, curr_boundary, curr_boundary + 620*child.ntracks, parent_surface_node)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":561,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":560,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":562,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent_surface_node)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
print(id)
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil or #parent.children <= 1 then
add_node(xlo, y, parent.content, grandparent_surface_node)
return
end
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
local parent_xlo = parent_x - 620/2
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent_surface_node)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + box_height(parent_surface_node) + 50, curr_boundary, curr_boundary + 620*child.ntracks, parent_surface_node)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":560,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":560,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":561,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":559,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":560,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":554,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent_surface_node)
print('add node', x)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
print('aa 1', surface_node.x)
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
print('aa 2', surface_node.x)
if parent_surface_node then
print('aa', surface_node.x, parent_surface_node.x)
add_edge(surface_node, parent_surface_node)
end
return surface_node
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":558,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":559,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":554,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent_surface_node)
print('add node', x)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent_surface_node then
print('aa', surface_node.x, parent_surface_node.x)
add_edge(surface_node, parent_surface_node)
end
return surface_node
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":557,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":557,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":554,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":558,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_edge = function(node, parent)
print('add edge', node.x, node.y, parent.x, parent.y)
local line = {
type='line',
data={
parent.x + 600/2, parent.y + box_height(node),
node.x + 600/2, node.y,
},
}
table.insert(Surface, line)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":556,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":557,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":554,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":556,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent_surface_node)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent_surface_node then
add_edge(surface_node, parent_surface_node)
end
return surface_node
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":555,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":555,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":554,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":556,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_edge = function(node, parent)
print('add edge', node.id, parent.id)
local line = {
type='line',
data={
parent.x + 600/2, parent.y + box_height(node),
node.x + 600/2, node.y,
},
}
table.insert(Surface, line)
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":554,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":555,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":554,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":551,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent_surface_node)
print('add node')
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent_surface_node then
add_edge(surface_node, parent_surface_node)
end
return surface_node
end
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent_surface_node)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
print(id)
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil then
add_node(xlo, y, parent.content, grandparent_surface_node)
return
end
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
local parent_xlo = parent_x - 620/2
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent_surface_node)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + box_height(parent_surface_node) + 50, curr_boundary, curr_boundary + 620*child.ntracks, parent_surface_node)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":553,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":552,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":554,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":551,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent_surface_node)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
print(id)
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil then
add_node(xlo, y, parent.content, grandparent_surface_node)
return
end
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
local parent_xlo = parent_x - 620/2
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + box_height(parent_surface_node) + 50, curr_boundary, curr_boundary + 620*child.ntracks, parent_surface_node)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":552,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":552,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":553,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":551,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":551,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":552,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":547,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":551,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_node = function(x, y, text, parent)
print('add node')
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent then
add_edge(node, parent)
end
return surface_node
end
{"on.mouse_release":367,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"on":1,"on.text_input":388,"render_thread_to_surface":525,"dehtml":456,"add_thick_line":400,"to_text":180,"copy_shape":396,"fw_parent":550,"fw_app":"mastodon-luaML","initialize_editor":338,"line_height":365,"update_editor_box":430,"compute_layout":385,"on.code_change":473,"box_height":345,"load_from_iterator":463,"schema1_of_y":366,"split_lines":469,"A":474,"add_node":550,"font":353,"on.initialize":446,"ntracks":505,"render_node_and_descendants":547,"compute_ntracks":519,"Input_filename":436,"Viewport":303,"B":379,"Surface":434,"vy":8,"scale":7,"add_edge":551,"y_of_schema1":364,"on.draw":418,"on.mouse_press":179,"vx":5}
add_edge = function(node, parent)
print('add edge')
local line = {
type='line',
data={
parent.x + 600/2, parent.y + box_height(node),
node.x + 600/2, node.y,
},
}
table.insert(Surface, line)
end
{"schema1_of_y":366,"on.keychord_press":391,"split_lines":469,"fw_parent":549,"y_of_schema1":364,"fw_app":"mastodon-luaML","add_node":550,"render_node_and_descendants":547,"Input_filename":436,"Cursor_node":172,"compute_layout":385,"add_edge":548,"to_text":180,"scale":7,"initialize_editor":338,"on.text_input":388,"ntracks":505,"copy_shape":396,"compute_ntracks":519,"render_thread_to_surface":525,"line_height":365,"Surface":434,"add_thick_line":400,"dehtml":456,"on.draw":418,"on":1,"vx":5,"B":379,"Viewport":303,"update_editor_box":430,"on.mouse_press":179,"vy":8,"font":353,"A":474,"on.initialize":446,"load_from_iterator":463,"box_height":345,"on.mouse_release":367,"on.code_change":473,"on.update":368}
add_node = function(x, y, text, parent)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
if parent then
add_edge(node, parent)
end
return surface_node
end
{"schema1_of_y":366,"on.keychord_press":391,"split_lines":469,"fw_parent":548,"y_of_schema1":364,"fw_app":"mastodon-luaML","add_node":549,"render_node_and_descendants":547,"Input_filename":436,"Cursor_node":172,"compute_layout":385,"add_edge":548,"to_text":180,"scale":7,"initialize_editor":338,"on.text_input":388,"ntracks":505,"copy_shape":396,"compute_ntracks":519,"render_thread_to_surface":525,"line_height":365,"Surface":434,"add_thick_line":400,"dehtml":456,"on.draw":418,"on":1,"vx":5,"B":379,"Viewport":303,"update_editor_box":430,"on.mouse_press":179,"vy":8,"font":353,"A":474,"on.initialize":446,"load_from_iterator":463,"box_height":345,"on.mouse_release":367,"on.code_change":473,"on.update":368}
add_node = function(x, y, text, parent)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
add_edge(node, parent)
return surface_node
end
{"schema1_of_y":366,"on.keychord_press":391,"split_lines":469,"fw_parent":547,"y_of_schema1":364,"fw_app":"mastodon-luaML","add_node":546,"render_node_and_descendants":547,"Input_filename":436,"Cursor_node":172,"compute_layout":385,"add_edge":548,"to_text":180,"scale":7,"initialize_editor":338,"on.text_input":388,"ntracks":505,"copy_shape":396,"compute_ntracks":519,"render_thread_to_surface":525,"line_height":365,"Surface":434,"add_thick_line":400,"dehtml":456,"on.draw":418,"on":1,"vx":5,"B":379,"Viewport":303,"update_editor_box":430,"on.mouse_press":179,"vy":8,"font":353,"A":474,"on.initialize":446,"load_from_iterator":463,"box_height":345,"on.mouse_release":367,"on.code_change":473,"on.update":368}
add_edge = function(node, parent)
local line = {
type='line',
data={
parent.x + 600/2, parent.y + box_height(node),
node.x + 600/2, node.y,
},
}
table.insert(Surface, line)
end
render_node_and_descendants = function(nodes, id, y, xlo, xhi, grandparent)
-- draw a parent 'id' and its children
-- also draw an edge from grandparent to parent if provided
print(id)
-- position the root between xlo and xhi to be closer to children with fewer tracks
local parent = nodes[id]
if parent.children == nil then
add_node(xlo, y, parent.content, grandparent)
return
end
local total_boundaries = 0
local curr_boundary = xlo
for child_idx = 1,#parent.children-1 do
local child_id = parent.children[child_idx]
local child = nodes[child_id]
curr_boundary = curr_boundary + 620 * child.ntracks
total_boundaries = total_boundaries + curr_boundary
end
local parent_x = total_boundaries / (#parent.children-1)
local parent_xlo = parent_x - 620/2
local parent_surface_node = add_node(parent_xlo, y, parent.content, grandparent)
local curr_boundary = xlo
for _,child_id in ipairs(parent.children) do
local child = nodes[child_id]
render_node_and_descendants(nodes, child_id, y + box_height(parent_surface_node) + 50, curr_boundary, curr_boundary + 620*child.ntracks)
curr_boundary = curr_boundary + 620*child.ntracks
end
end
{"schema1_of_y":366,"on.keychord_press":391,"split_lines":469,"fw_parent":546,"y_of_schema1":364,"fw_app":"mastodon-luaML","add_node":546,"render_node_and_descendants":547,"Input_filename":436,"Cursor_node":172,"compute_layout":385,"to_text":180,"scale":7,"initialize_editor":338,"on.text_input":388,"ntracks":505,"copy_shape":396,"compute_ntracks":519,"render_thread_to_surface":525,"line_height":365,"Surface":434,"add_thick_line":400,"dehtml":456,"on.draw":418,"on":1,"vx":5,"B":379,"Viewport":303,"update_editor_box":430,"on.mouse_press":179,"vy":8,"font":353,"A":474,"on.initialize":446,"load_from_iterator":463,"box_height":345,"on.mouse_release":367,"on.code_change":473,"on.update":368}
{"schema1_of_y":366,"on.keychord_press":391,"split_lines":469,"fw_parent":545,"y_of_schema1":364,"fw_app":"mastodon-luaML","add_node":546,"render_node_and_descendants":545,"Input_filename":436,"Cursor_node":172,"compute_layout":385,"to_text":180,"scale":7,"initialize_editor":338,"on.text_input":388,"ntracks":505,"copy_shape":396,"compute_ntracks":519,"render_thread_to_surface":525,"line_height":365,"Surface":434,"add_thick_line":400,"dehtml":456,"on.draw":418,"on":1,"vx":5,"B":379,"Viewport":303,"update_editor_box":430,"on.mouse_press":179,"vy":8,"font":353,"A":474,"on.initialize":446,"load_from_iterator":463,"box_height":345,"on.mouse_release":367,"on.code_change":473,"on.update":368}
add_node = function(x, y, text, grandparent)
local surface_node = {
x=x, y=y,
width=600,
type='text',
data=split_lines(dehtml(text)),
bg={r=0.7,g=0.7, b=1.0},
}
compute_layout(surface_node, surface_node.x, surface_node.y, Surface)
return surface_node
end