FBDRJ53NJ5BWDQGU2GWZ6NEYHKCCRD7RODMIG7QQZBRFUB4HR7OAC to_text = function(x,y)for _,node in ipairs(Surface) doif node.type == 'text' thenif x >= vx(node.x) and node.w and x < vx(node.x + node.w) thenif y >= vy(node.y) and node.h and y < vy(node.y + node.h) thenreturn nodeendendendendend
{"to_text":180,"on.mouse_pressed":179,"on.mouse_released":178,"initialize_editor":74,"box_height":44,"on.keychord_pressed":176,"on":1,"on.textinput":177,"font":104,"on.code_changed":140,"parent":179,"Surface":165,"on.draw":162,"vx":5,"Page":111,"Viewport":29,"compute_layout":157,"scale":7,"vy":8,"Cursor_node":172,"on.update":14}
on.mouse_pressed = function(x,y, mouse_button)if Cursor_node thenCursor_node.show_cursor = nilCursor_node = nilendlocal node = to_text(x,y)if node thenCursor_node = nodeedit.mouse_pressed(node.editor, x,y, mouse_button)elsePan = {x=Viewport.x+x,y=Viewport.y+y}endend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"on.textinput":177,"vy":8,"on.mouse_pressed":179,"on.mouse_released":178,"on.update":14,"on.keychord_pressed":176,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":178}
on.mouse_released = function(x,y, mouse_button)if Pan thenPan = nilelseif Cursor_node thenCursor_node.show_cursor = trueedit.mouse_released(Cursor_node.editor, x,y, mouse_button)endend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"on.textinput":177,"vy":8,"on.mouse_pressed":174,"on.mouse_released":178,"on.update":14,"on.keychord_pressed":176,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":177}
on.textinput = function(t)if Cursor_node thenedit.textinput(Cursor_node.editor, t)endend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"on.textinput":177,"vy":8,"on.mouse_pressed":174,"on.mouse_released":175,"on.update":14,"on.keychord_pressed":176,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":176}
on.keychord_pressed = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0elseif Cursor_node thenedit.keychord_pressed(Cursor_node.editor, chord, key)endend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":174,"on.mouse_released":175,"on.update":14,"on.keychord_pressed":176,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":175}
on.mouse_released = function(x,y, mouse_button)if Pan thenPan = nilelseif Cursor_node thenedit.mouse_released(Cursor_node.editor, x,y, mouse_button)endend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":174,"on.mouse_released":175,"on.update":14,"on.keychord_pressed":17,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":174}
on.mouse_pressed = function(x,y, mouse_button)if Cursor_node thenCursor_node.show_cursor = nilCursor_node = nilendlocal node = to_text(x,y)if node thenCursor_node = nodenode.show_cursor = trueedit.mouse_pressed(node.editor, x,y, mouse_button)elsePan = {x=Viewport.x+x,y=Viewport.y+y}endend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":174,"on.mouse_released":171,"on.update":14,"on.keychord_pressed":17,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":173}
on.mouse_pressed = function(x,y, mouse_button)local node = to_text(x,y)if node thenCursor_node = nodenode.show_cursor = trueedit.mouse_pressed(node.editor, x,y, mouse_button)elsePan = {x=Viewport.x+x,y=Viewport.y+y}endend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":173,"on.mouse_released":171,"on.update":14,"on.keychord_pressed":17,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":172}
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":169,"on.mouse_released":171,"on.update":14,"on.keychord_pressed":17,"Cursor_node":172,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":171}
Cursor_node = nil
on.mouse_released = function(x,y, mouse_button)if Pan thenPan = nilelselocal node = to_text(x,y)if node thenedit.mouse_released(node.editor, x,y, mouse_button)endendend
{"Surface":165,"to_text":168,"on.code_changed":140,"vx":5,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":169,"on.mouse_released":171,"on.update":14,"on.keychord_pressed":17,"on.draw":162,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"Page":111,"font":104,"parent":169}
on.mouse_released = function(x,y, mouse_button)if Pan thenPan = nilelselocal node = to_text(x,y)if node thenedit.mouse_released(node.editor, x,y, mouse_button)endend
{"Surface":165,"to_text":168,"on.code_changed":140,"parent":169,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":169,"on.mouse_released":170,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
on.mouse_pressed = function(x,y, mouse_button)local node = to_text(x,y)if node thennode.show_cursor = trueprint('show cursor')edit.mouse_pressed(node.editor, x,y, mouse_button)elseprint('pan')Pan = {x=Viewport.x+x,y=Viewport.y+y}endend
{"Surface":165,"to_text":168,"on.code_changed":140,"parent":168,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":169,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
to_text = function(x,y)for _,node in ipairs(Surface) doif node.type == 'text' thenprint(x, y, node.data[1], node.x, node.y, node.w, node.h)if x >= vx(node.x) and node.w and x < vx(node.x + node.w) thenif y >= vy(node.y) and node.h and y < vy(node.y + node.h) thenreturn nodeendendendendend
{"Surface":165,"to_text":168,"on.code_changed":140,"parent":167,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":167,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
on.mouse_pressed = function(x,y, mouse_button)local node = to_text(x,y)if node thennode.show_cursor = trueprint('show cursor')elseprint('pan')Pan = {x=Viewport.x+x,y=Viewport.y+y}endend
{"Surface":165,"to_text":166,"on.code_changed":140,"parent":166,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":167,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
to_text = function(x,y)for _,node in ipairs(Surface) doif node.type == 'text' thenprint(x, y, node.data[1], node.x, node.y, node.w, node.h)if x >= node.x and node.w and x < node.x + node.w thenif y >= node.y and node.h and y < node.y + node.h thenreturn nodeendendendendend
{"Surface":165,"to_text":166,"on.code_changed":140,"parent":165,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":160,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
{"Surface":165,"to_text":164,"on.code_changed":140,"parent":164,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":160,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
Surface = {-- test data{type='line', data={0,0, 0,600}},{type='line', data={0,0, 800,0}},{type='text', data={'0'}, x=-20,y=-20},{type='rectangle', x=50,y=50, w=20,h=80, r=1,g=0,b=0},{type='text', data={'abc', 'def'}, x=150, y=50, w=50,h=50, fg={r=0,g=0.4, b=0.9}},{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},{type='bezier', data={25,25, 25,125, 75,25, 125,25}},}
to_text = function(x,y)for _,node in ipairs(Surface) doif node.type == 'text' thenprint(x, y, node.data[1], node.x, node.y, node.w, node.h)if x >= node.x and x < node.x + node.w thenif y >= node.y and y < node.y + node.h thenreturn nodeendendendendend
{"Surface":116,"to_text":164,"on.code_changed":140,"parent":163,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":160,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
to_text = function(x,y)for _,node in ipairs(Surface) doif node.type == 'text' thenprint(node.data[1])if x >= node.x and x < node.x + node.w thenif y >= node.y and y < node.y + node.h thenreturn nodeendendendendend
{"Surface":116,"to_text":163,"on.code_changed":140,"parent":162,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":160,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
on.draw = function()for _,obj in ipairs(Surface) dolove.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)if obj.type == 'rectangle' thenlove.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))elseif obj.type == 'line' thenif obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y thenobj.saved_zoom = Viewport.zoomobj.saved_x = Viewport.xobj.saved_y = Viewport.yobj.zdata = {}for i=1,#obj.data,2 dotable.insert(obj.zdata, vx(obj.data[i]))table.insert(obj.zdata, vy(obj.data[i+1]))endendlove.graphics.line(unpack(obj.zdata))elseif obj.type == 'circle' thenlove.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))elseif obj.type == 'arc' thenlove.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)elseif obj.type == 'ellipse' thenlove.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))elseif obj.type == 'bezier' thenif obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y thenobj.saved_zoom = Viewport.zoomobj.saved_x = Viewport.xobj.saved_y = Viewport.yzdata = {}for i=1,#obj.data,2 dotable.insert(zdata, vx(obj.data[i]))table.insert(zdata, vy(obj.data[i+1]))endobj.zdata = love.math.newBezierCurve(zdata):render()endlove.graphics.line(unpack(obj.zdata))elseif obj.type == 'text' thenlocal scaled_fontsize = scale(obj.fontsize or 20)if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y or obj.scaled_fontsize ~= scaled_fontsize thenobj.saved_zoom = Viewport.zoomobj.saved_x = Viewport.xobj.saved_y = Viewport.yobj.scaled_fontsize = scaled_fontsizeobj.text = love.graphics.newText(font(obj, scaled_fontsize), obj.data)initialize_editor(obj)endif obj.w == nil thenlove.graphics.draw(obj.text, vx(obj.x), vy(obj.y))elseedit.draw(obj.editor, obj.fg or {r=0,g=0,b=0}, not obj.show_cursor)endendendend
{"Surface":116,"to_text":159,"on.code_changed":140,"parent":161,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":160,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":162}
on.draw = function()for _,obj in ipairs(Surface) dolove.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)if obj.type == 'rectangle' thenlove.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))elseif obj.type == 'line' thenif obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y thenobj.saved_zoom = Viewport.zoomobj.saved_x = Viewport.xobj.saved_y = Viewport.yobj.zdata = {}for i=1,#obj.data,2 dotable.insert(obj.zdata, vx(obj.data[i]))table.insert(obj.zdata, vy(obj.data[i+1]))endendlove.graphics.line(unpack(obj.zdata))elseif obj.type == 'circle' thenlove.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))elseif obj.type == 'arc' thenlove.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)elseif obj.type == 'ellipse' thenlove.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))elseif obj.type == 'bezier' thenif obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y thenobj.saved_zoom = Viewport.zoomobj.saved_x = Viewport.xobj.saved_y = Viewport.yzdata = {}for i=1,#obj.data,2 dotable.insert(zdata, vx(obj.data[i]))table.insert(zdata, vy(obj.data[i+1]))endobj.zdata = love.math.newBezierCurve(zdata):render()endlove.graphics.line(unpack(obj.zdata))elseif obj.type == 'text' thenlocal scaled_fontsize = scale(obj.fontsize or 20)if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y or obj.scaled_fontsize ~= scaled_fontsize thenobj.saved_zoom = Viewport.zoomobj.saved_x = Viewport.xobj.saved_y = Viewport.yobj.scaled_fontsize = scaled_fontsizeobj.text = love.graphics.newText(font(obj, scaled_fontsize), obj.data)initialize_editor(obj)endif obj.w == nil thenlove.graphics.draw(obj.text, vx(obj.x), vy(obj.y))elseedit.draw(obj.editor, obj.fg or {r=0,g=0,b=0}, obj.show_cursor)endendendend
{"Surface":116,"to_text":159,"on.code_changed":140,"parent":160,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":160,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":161}
on.mouse_pressed = function(x,y, mouse_button)local node = to_text(x,y)if node thennode.show_cursor = trueelsePan = {x=Viewport.x+x,y=Viewport.y+y}endend
{"Surface":116,"to_text":159,"on.code_changed":140,"parent":159,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":160,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":158}
to_text = function(x,y)for _,node in ipairs(Surface) doif node.type == 'text' thenif x >= node.x and x < node.x + node.w thenif y >= node.y and y < node.y + node.h thenreturn nodeendendendendend
{"Surface":116,"to_text":159,"on.code_changed":140,"parent":158,"on":1,"Viewport":29,"vy":8,"on.mouse_pressed":12,"on.mouse_released":13,"on.update":14,"on.keychord_pressed":17,"vx":5,"initialize_editor":74,"box_height":44,"scale":7,"compute_layout":157,"font":104,"Page":111,"on.draw":158}