Skip to content

1681-engine / ui / fitToViewport

Function: fitToViewport() ​

ts
function fitToViewport(
   rect, 
   viewport, 
   options?
): FitResult;

Defined in: src/ui/layout/fitToViewport.ts:34

Fits a window into the screen so it never overflows it: shrunk down to minScale if that is allowed, then cut to what is left (the caller scrolls its body), and moved back inside the edges. rect is where and how big the window wants to be, in its own units; x, y are screen pixels.

Parameters ​

ParameterType
rectSize | Rect
viewportSize
optionsFitOptions

Returns ​

FitResult

Released under the MIT License.