on.mouse_release = function(x,y, mouse_button) if Pan then Pan = nil elseif Edge then local src = Edge.source local sx, sy = sx(x), sy(y) local dest = on_border(sx,sy) if dest == nil then local line_height = src.editor.line_height dest = {id=next_key(), type='text', x=sx-60,y=sy-1.5*line_height, margin=0, width=120, outgoing_edges={}, incoming_edges={src.id}} table.insert(Nodes[src.id].outgoing_edges, dest.id) else if src.id == dest.id then -- avoid edge to self for now; there's no way to delete it elseif array.find(dest.incoming_edges, src.id) then -- no duplicate edges else table.insert(dest.incoming_edges, src.id) table.insert(Nodes[src.id].outgoing_edges, dest.id) end end Nodes[dest.id] = dest Global_next_save = Current_time + 3 Edge = nil A() elseif Resize_node then Global_next_save = Current_time + 3 Resize_node = nil Resize = nil elseif Move_node then Global_next_save = Current_time + 3 Move_node = nil Move = nil A() elseif Cursor_node then Cursor_node.show_cursor = true edit.mouse_release(Cursor_node.editor, x,y, mouse_button) end end