aspect-fit
v1.0.2
Published
Returns scale and dimensions of a rectagle that will fit a specific area.
Downloads
744
Maintainers
Readme
aspect-fit
Returns scale and dimensions of a rectagle that will fit a specific area.
See aspect-fill for a fill calculation
Installation
npm i aspect-fit
Usage
var fit = require("aspect-fit")
// fit(areaWidth, areaHeight, parentWidth, parentHeight);
var fitResult = fill(400, 200, 800, 400);
// fitResult == {scale:2, width:800, height:400}
License
MIT, see LICENSE.md for details.