little tool for building Wardley maps
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}}
		else
			table.insert(dest.incoming_edges, src.id)
		end
		Nodes[dest.id] = dest
		table.insert(Nodes[src.id].outgoing_edges, dest.id)
		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