A node will take up as much vertical space as it needs given its text. But we can resize its width.
7UWLGLA6FAO42YN6IBEFAKMTDUY26IJAQDBHGHHH55OK2SHUIZHAC
KI6LF2LF2LK6Q7SRWN3U4TJ25Y6BGJ2M3AU5FUTN6JIVA2MUBEXAC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
M2JTUQQL2JBWHMN3JG6KO6NDHZ5X7ZW2RF7HVG4WVMS5TE6DYUPQC
DF3MDABRK7XMY2Z2QOX6HO5CEZKKJZCO5CB4OOCOA5IBWJEEBUTAC
TBPJ5WSRM5IKQH7FTAVYTWWUBWW7G2CLT5M6FN7CMPLD6Y77YIWQC
ZQMQVMFWZIGWBRCB455IKHPTAOUYPLYCSC44NBPPET557RGVRX3AC
XCEP7G5GRX6WQGCROJDNZRTLSITGAETL7EFCFTR74S36VXK32HBQC
on_resize = function(sx,sy)
for _,node in ipairs(Nodes) do
if sx >= node.x+node.w+20 and sx < node.x+node.w+24 then
local buffer_height = math.max(node.h, 3*node.editor.line_height)
if sy >= node.y and sy < node.y+buffer_height then
return true
end
end
end
end
on_move_bar = function(sx,sy)
for _,node in ipairs(Nodes) do
if sx >= node.x-10 and sx < node.x-10+node.w/2 then
if sy >= node.y - 40 and sy < node.y-20 then
return true
end
end
end
end
sy = function(vy)
return vy/Viewport.zoom + Viewport.y
end
sx = function(vx)
return vx/Viewport.zoom + Viewport.x
end
set_mouse_cursor = function(name)
if Mouse_cursor ~= name then
Mouse_cursor = name
love.mouse.setCursor(love.mouse.getSystemCursor(name))
end
end
-- render background if necessary
local node_to_render
if node.bg then
node_to_render = {type='rectangle', drawmode='line', r=0.5, g=0.5, b=0.5, x=node.x-10, y=node.y-10, corner_radius=5}
table.insert(nodes_to_render, node_to_render)
end
-- render a bar to grab for moving the node
local move_bar = {type='rectangle', r=0.5,g=0.5,b=0.5, x=node.x-10, y=node.y-10-10-4, h=4}
table.insert(nodes_to_render, move_bar)
-- render bounding box
local bounding_box = {type='rectangle', drawmode='line', r=0.5, g=0.5, b=0.5, x=node.x-10, y=node.y-10, corner_radius=5}
table.insert(nodes_to_render, bounding_box)
if node_to_render then
node_to_render.w = node.w+20
node_to_render.h = math.max(node.h, 3*node.editor.line_height)+20
end
move_bar.w = node.w/2
bounding_box.w = node.w+20
local buffer_height = math.max(node.h, 3*node.editor.line_height)
bounding_box.h = buffer_height+20
-- resize affordance
table.insert(nodes_to_render, {type='line', r=0.7,g=0.7,b=0.7, data={node.x+node.w+20,node.y, node.x+node.w+20,node.y+buffer_height}})
table.insert(nodes_to_render, {type='line', r=0.7,g=0.7,b=0.7, data={node.x+node.w+20+4,node.y, node.x+node.w+20+4,node.y+buffer_height}})