pixelCeil

Commons
stable

Ceil a sub-pixel value to the nearest physical pixel boundary using `devicePixelRatio`. Prevents layout rounding errors in high-DPI positioning calculations.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

val
requis
number
A CSS pixel value (fractional or whole). Multiplied by `devicePixelRatio`, ceiled, then divided back to get the nearest physical-pixel boundary.

API

Valeur de retour

La valeur retournée par cet util.

The input ceiled to the nearest physical pixel grid line in CSS pixel units.

Usage

Exemples

Extraits de code prêts à coller.

Ceil to physical pixel (2x display)

typescript