A node will take up as much vertical space as it needs given its text. But we can resize its width.
SMZJGK56DYOP2CYIYDV3QXVHL5P52IEF34GFBESNMULJDMDLJR2AC
JNS2ATVJRXCIBGRFRPPN63OAOQRVV7GE2VRAL3T6YNRXFX6YYMQAC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
ZUXG2RU4WF5WF7EYU2XQJ6AERLJLOMGDEXWRMGWHT5DR3B7X7MWQC
J62CVGNGJZSN7TMTE2SG53O47YG4SJGJFTUFKVOZY4TM4KAC566QC
T7T66GEUFLP3YHZN5UNOVBYK33KISJWJQKCPZU6MQH45KSU7CZZQC
YUQ4YINAT5YTK3CAY4VK3HSYQ4D63FXLLPMC4R3DUFHIZIUQO7WQC
UJ2RZ43LIVRIBWIXHXMLIQIQTL32VVEN4CVU7PEBTITQFPO4EXXQC
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}})