Skip to content

1681-engine / index / fitScale

Function: fitScale() ​

ts
function fitScale(
   contentW, 
   contentH, 
   boxW, 
   boxH
): number;

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

The whole-number scale content of this size is drawn at to fit a box (a map panel, a preview): the largest integer that fits both ways, never below 1, so every source pixel is the same number of screen pixels.

Parameters ​

ParameterType
contentWnumber
contentHnumber
boxWnumber
boxHnumber

Returns ​

number

Released under the MIT License.