@vue-pdf-viewer/viewer
Version:
A vue-pdf-viewer component for Vue and Nuxt. Suitable for vue-pdf document.
21 lines (20 loc) • 931 B
TypeScript
/**
* Utility for adjusting PDF.js annotation popup position to stay within page bounds.
* Popups use percentage-based positioning relative to their page.
* The popup should stay visually connected to its parent annotation.
*/
export interface PopupBoundsResult {
needsAdjustment: boolean;
left?: string;
top?: string;
}
/**
* Check if a popup overflows the page bounds and calculate adjusted position.
* The popup will try to stay adjacent to its parent annotation, flipping sides if needed.
*
* @param popup - The .popup element inside .popupAnnotation
* @param page - The annotation layer element (.vpv-annotation-layer)
* @param annotationRect - Bounding rect of the parent annotation element
* @returns Adjustment result with new percentage-based left/top if needed
*/
export declare function adjustPopupBounds(popup: HTMLElement, page: HTMLElement, annotationRect: DOMRect | null): PopupBoundsResult;