aspect-fit

Returns scale and dimensions of a rectagle that will fit a specific area.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
aspect-fit
001.0.27 years ago7 years agoMinified + gzip package size for aspect-fit in KB

Readme

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.