Skip to content

@halone/sdk / fitBox

Function: fitBox() ​

ts
function fitBox(
   width, 
   height, 
   aspect
): object;

The largest box of [aspect] that fits in [width] by [height], centred: object-fit: contain for a shape the element does not have.

Parameters ​

width ​

number

height ​

number

aspect ​

number

Returns ​

object

height ​

ts
height: number;

width ​

ts
width: number;

x ​

ts
x: number;

y ​

ts
y: number;

Released under the MIT License.