public static void updateSelection() {
        double currentX = CanvasController.currentMousePoint.getX() > 0 ? CanvasController.currentMousePoint.getX() : 0;
        double currentY = CanvasController.currentMousePoint.getY() > 0 ? CanvasController.currentMousePoint.getY() : 0;

        //compute the current selection rectangle
        double width = Math.abs(CanvasController.mousePressPoint.getX() - currentX);
        double height = Math.abs(CanvasController.mousePressPoint.getY() - currentY);
        double x = Math.min(CanvasController.mousePressPoint.getX(), currentX);
        double y = Math.min(CanvasController.mousePressPoint.getY(), currentY);

        selectionRectangle = new Rectangle2D.Double(x, y, width, height);

        for (String id : CanvasController.getPlacesAndTransitionFiguresIds() ) {
            Positionable figure = (Positionable)CanvasController.getFigureById(id);
            boolean inSelectionRectangle = figure.intersects(selectionRectangle);
            if (inSelectionRectangle) {
                SelectionController.addFigureToSelection(figure);
            } else {
                if (!CanvasController.selectionKeyActive) {
                    SelectionController.removeFigureFromSelection(figure);
                }
            }
        }

        onUpdateSelectedElements();
    }