public void mouseReleased(MouseEvent e) {
        // update selection rectangle
        updateSelectionSize(e, pageViewComponent);
        if (documentViewModel.getViewToolMode() ==
                DocumentViewModel.DISPLAY_TOOL_SELECTION) {
            // clear the rectangle
            clearRectangle(pageViewComponent);
            pageViewComponent.repaint();
        }
        // link annotations tool.
        else if (documentViewModel.getViewToolMode() ==
                DocumentViewModel.DISPLAY_TOOL_LINK_ANNOTATION &&
                isDragged){
            createNewLinkAnnotation();
            // clear the rectangle
            clearRectangle(pageViewComponent);
            pageViewComponent.repaint();
        }

        isDragged = false;
    }