1.0.2 • Published 8 years ago

aspect-fit v1.0.2

Weekly downloads
1,807
License
MIT
Repository
github
Last release
8 years ago

aspect-fit

stable

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}

NPM

License

MIT, see LICENSE.md for details.