
import { getDomNodePagePosition } from '../../../../base/browser/dom.js';

function isMousePositionWithinElement(element, posx, posy) {
    const elementRect = getDomNodePagePosition(element);
    if (posx < elementRect.left
        || posx > elementRect.left + elementRect.width
        || posy < elementRect.top
        || posy > elementRect.top + elementRect.height) {
        return false;
    }
    return true;
}
function shouldShowHover(hoverEnabled, multiCursorModifier, mouseEvent) {
    if (hoverEnabled === 'on') {
        return true;
    }
    if (hoverEnabled === 'off') {
        return false;
    }
    return isTriggerModifierPressed(multiCursorModifier, mouseEvent.event);
}
function isTriggerModifierPressed(multiCursorModifier, event) {
    if (multiCursorModifier === 'altKey') {
        return event.ctrlKey || event.metaKey;
    }
    return event.altKey;
}

export { isMousePositionWithinElement, isTriggerModifierPressed, shouldShowHover };
