Skip to content

1681-engine / index / zoomResolution

Function: zoomResolution() ​

ts
function zoomResolution(
   zoom, 
   devicePixelRatio, 
   minDpr?, 
   maxResolution?
): number;

Defined in: src/core/pixelZoom.ts:79

The renderer's resolution for a zoom: 1 at a whole zoom (one backing pixel per CSS pixel, the cheapest fill), and at a fractional one the least whole resolution up to maxResolution (default 4) that makes zoom × resolution whole (2 at ×1.5, so a world pixel is 3 backing pixels) — but only on a screen of devicePixelRatio ≥ minDpr (default 1.5): a coarser one cannot show the difference and would pay the fill for nothing. 1 when none fits.

Parameters ​

ParameterTypeDefault value
zoomnumberundefined
devicePixelRationumberundefined
minDprnumber1.5
maxResolutionnumber4

Returns ​

number

Released under the MIT License.