@pierre/diffs
Version:
14 lines • 665 B
TypeScript
//#region src/utils/roundToDevicePixel.d.ts
/**
* Snap a CSS-pixel value to the nearest device-pixel boundary. Browsers store
* scrollTop on the device-pixel grid on fractional-DPR displays (1.25x, 1.5x,
* etc.), so rounding computed scroll targets against that grid keeps delta
* math settling cleanly instead of hovering around fractional residuals.
*
* Reads window.devicePixelRatio fresh on each call so monitor-switching and
* zoom changes are picked up without needing to flush any cached value.
*/
declare function roundToDevicePixel(value: number): number;
//#endregion
export { roundToDevicePixel };
//# sourceMappingURL=roundToDevicePixel.d.ts.map