UNPKG

ducjs

Version:

The duc 2D CAD file format is a cornerstone of our advanced design system, conceived to cater to professionals seeking precision and efficiency in their design work.

32 lines (31 loc) 1.76 kB
import { DucElement } from "../types/elements"; import { CombinedMeasure, SupportedMeasures } from "./scopes"; /** * Gets translation factor between current scope and element scope */ export declare function getElementTranslationFactor(currentScope: CombinedMeasure, elementScope: CombinedMeasure): number; /** * Gets the appropriate unit for the current zoom level * * @param zoom - Current zoom level * @param mainMeasure - Main/base measurement unit * @param scopeExpThreshold - Controls the sensitivity of precision scope changes * @returns The most appropriate measurement unit for the current zoom */ export declare function getPrecisionScope(zoom: number, mainMeasure: SupportedMeasures, scopeExpThreshold: number): SupportedMeasures; export declare const coordinateToRealMeasure: (coordinate: number, currentScope: CombinedMeasure, elementScope: CombinedMeasure) => number; export declare const realMeasureToCoordinate: (realMeasure: number, gridUnit: number) => number; export declare function filterElementsByScope<T extends DucElement>(elements: readonly T[], currentScope: CombinedMeasure): T[]; /** * Calculates the approximate size of a single physical device pixel in millimeters. * * This calculation is based on the standard CSS definition of a reference pixel * (1/96th of an inch) and the current devicePixelRatio of the window. * * It reflects the effective size of the smallest addressable pixel by the browser, * considering screen density and browser/OS zoom levels. * * @returns {number} The approximate size of a physical pixel in millimeters. * Returns NaN if window or window.devicePixelRatio is not available (e.g., in a Node.js environment). */ export declare const getPhysicalDevicePixelSizeInMm: () => number;