Skip to content

createAnchorFromPoint

Anchors a popover at a pointer position — used for a context menu, which is raised by a right-click or a long-press whose coordinates are where the user is looking.

Import:

import { createAnchorFromPoint } from 'obsidian-dev-utils/obsidian/popovers/popover-anchor';

Signature:

function createAnchorFromPoint(x: number, y: number, doc: Document): PopoverAnchor

Parameters:

ParameterTypeDescription
xnumberThe viewport x coordinate.
ynumberThe viewport y coordinate.
docDocumentThe document the coordinates belong to.

Returns: PopoverAnchor — The anchor.