pothi.love/0007-to_text

13 lines
331 B
Plaintext

to_text = function(x,y)
local sx, sy = x/Viewport.zoom + Viewport.x, y/Viewport.zoom + Viewport.y
for _,node in ipairs(Surface) do
if node.type == 'text' then
if sx >= node.x and node.w and sx < node.x + node.w then
if sy >= node.y and node.h and sy < node.y + node.h then
return node
end
end
end
end
end