math-fit
v1.0.1
Published
Calculates the size and the position of a target to fit a container.
Readme
math-fit 
Calculates the size and the position of a target to fit a container.
Installation
With npm do:
$ npm install math-fit --saveInstall with component(1):
$ component install nk-components/math-fitUsage
var fit = require('math-fit');
var target = {
w: 200, // or width: 200
h: 100 // or height: 100
};
var parent = {
w: 200, // or width: 200
h: 200 // or height: 200
};
var coverValues = fit(target, parent); // same as fit.cover(target, parent);
//
// >>
// {
// left: float,
// top: float,
// width: float,
// height: float,
// scale: float
// }
var containValues = fit.contain(target, parent);License
MIT
