UNPKG

@aurigma/design-atoms-model

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

27 lines 953 B
import { PointF } from "../Math/index"; import { ArgumentException } from "../Exception"; import Environment from "../Utils/Environment"; export function pointsToInches(points) { return points / 72; } export function inchesToPixels(inches, dpi) { return inches * dpi; } export function pointsToPixels(points, dpi) { if (typeof points === "number") return _pointsToPixels(points, dpi); if (points instanceof PointF) return new PointF(_pointsToPixels(points.x, dpi), _pointsToPixels(points.y, dpi)); throw new ArgumentException("points"); } function _pointsToPixels(points, dpi) { var inches = pointsToInches(points); return inchesToPixels(inches, dpi); } export function pixelsToPoints(pixels, dpi) { return (pixels / dpi) * 72; } export function devicePixelsToCssPixels(devicePixels) { return devicePixels / Environment.devicePixelRatio; } //# sourceMappingURL=Convert.js.map