fit-box
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Fit Box

Fits a box within a boundary while keeping its original aspect ratio.

npm module

The box will either be scaled up or scaled down within the boundary:

fitBox({
  boundary: { width: 400, height: 300 },
  box: { width: 20, height: 60 },
});
// => { width: 100, height: 300 }

fitBox({
  boundary: { width: 400, height: 300 },
  box: { width: 1280, height: 760 },
});
// => { width: 400, height: 237.5 }

/fit-box/

    Package Sidebar

    Install

    npm i fit-box

    Weekly Downloads

    4

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    37.5 kB

    Total Files

    17

    Last publish

    Collaborators

    • christianhg