UNPKG

@mescius/dspdfviewer

Version:
60 lines (59 loc) 1.8 kB
import { IGcRect, IGcPoint } from "../Models/GcMeasurementTypes"; /** * DOM element's measurement utility. * */ export declare class GcMeasurement { /** * Resize the rectangle to fit the other one maintaining the aspect ratio. * @param sourceSize Source rectangle size. * @param fitSize Destination rectangle size. */ static fitWithAspectRatio(sourceSize: { width: number; height: number; }, fitSize: { width: number; height: number; }): { width: number; height: number; }; /** * Determine the size of the text relative to the active display device and current page state. * @param text * @param fontFamily * @param fontSize */ static measureDomText(text: string, fontFamily: string, fontSize: string): { w: number; h: number; }; /** * Returns DOM element outer size including margins and borders. * @param element */ static getElementOuterSize(element: HTMLElement): { w: number; h: number; }; /** * Returns DOM element inner size excluding margins and paddings. * @param element */ static getElementInnerSize(element: HTMLElement): { w: number; h: number; }; static intersectRect(r1: IGcRect, r2: IGcRect): boolean; static isPointInBounds(p: IGcPoint, bb: IGcRect): boolean; static getWindowScrollOffsets(): { left: number; top: number; }; static getWindowSize(): { w: number; h: number; }; static getAbsoluteOffsetLeft(elem: HTMLElement | null | undefined): number; static getAbsoluteOffsetTop(elem: HTMLElement | null | undefined): number; }