/** * Utility functions for calculating menu position with boundary constraints. * Used by both text selection menu and annotation selection menu. */ import type { RectBox } from './types'; export interface VisibleAreaInput { containerRect: DOMRect | null; textLayerRect: DOMRect | null; viewportWidth: number; viewportHeight: number; } export interface VisibleArea { left: number; top: number; right: number; bottom: number; } export interface MenuBoundsInput extends RectBox { yTop: number; visibleArea: VisibleArea; } export interface SelectionBounds extends RectBox { flipped: boolean; } export declare const MENU_WIDTH = 220; export declare const MENU_HEIGHT = 44; export declare const MENU_OFFSET = 8; export declare const MENU_PADDING = 8; /** * Calculate visible area of the page within the viewport container. * Returns bounds in page-relative coordinates. */ export declare function calculateVisibleArea(input: VisibleAreaInput): VisibleArea; /** * Calculate menu position with boundary constraints. * - Horizontal: shifts menu left/right to stay within visible area * - Vertical: flips menu above selection if it would overflow bottom */ export declare function calculateMenuBounds(input: MenuBoundsInput): SelectionBounds;