private Node setNode(Edge edge, MouseEvent e) {
        Node node;
        double mouseMapX = drawMapComponent.convertMouseXToMap(e.getX());
        double mouseMapY = drawMapComponent.convertMouseYToMap(e.getY());
        double fromDistance = Point2D.distance(edge.getFromNode().getxCoord(), edge.getFromNode().getyCoord(), mouseMapX, mouseMapY);
        double toDistance = Point2D.distance(edge.getToNode().getxCoord(), edge.getToNode().getyCoord(), mouseMapX, mouseMapY);
        if (fromDistance <= toDistance) {
            node = edge.getFromNode();
        } else {
            node = edge.getToNode();
        }
        return node;
    }