function showContextMenu() {
    if (layoutModeGet()) return false; // Hide context menu when it is in Layout Mode
    $('#contextMenu').css({
        visibility: 'visible',
        opacity: 1,
    });

    var windowHeight = $("#simulationArea").height() - $("#contextMenu").height() - 10;
    var windowWidth = $("#simulationArea").width() - $("#contextMenu").width() - 10;
    // for top, left, right, bottom
    var topPosition;
    var leftPosition;
    var rightPosition;
    var bottomPosition;
    if (ctxPos.y > windowHeight && ctxPos.x <= windowWidth) {
        //When user click on bottom-left part of window
        leftPosition = ctxPos.x;
        bottomPosition = $(window).height() - ctxPos.y;
        $("#contextMenu").css({
            left: `${leftPosition}px`,
            bottom: `${bottomPosition}px`,
            right: 'auto',
            top: 'auto',
        });
    } else if (ctxPos.y > windowHeight && ctxPos.x > windowWidth) {
        //When user click on bottom-right part of window
        bottomPosition = $(window).height() - ctxPos.y;
        rightPosition = $(window).width() - ctxPos.x;
        $("#contextMenu").css({
            left: 'auto',
            bottom: `${bottomPosition}px`,
            right: `${rightPosition}px`,
            top: 'auto',
        });
    } else if (ctxPos.y <= windowHeight && ctxPos.x <= windowWidth) {
        //When user click on top-left part of window
        leftPosition = ctxPos.x;
        topPosition = ctxPos.y;
        $("#contextMenu").css({
            left: `${leftPosition}px`,
            bottom: 'auto',
            right: 'auto',
            top: `${topPosition}px`,
        });
    } else {
        //When user click on top-right part of window
        rightPosition = $(window).width() - ctxPos.x;
        topPosition = ctxPos.y;
        $("#contextMenu").css({
            left: 'auto',
            bottom: 'auto',
            right: `${rightPosition}px`,
            top: `${topPosition}px`,
        });
    }
    ctxPos.visible = true;
    return false;
}
Function displays context menu
@category ux