aspectratio
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -55,5 +55,5 @@ var deprecate = require('util').deprecate; | ||
if (y > x) { | ||
return [Math.floor(yMax * x / y), yMax]; | ||
return [Math.round(yMax * x / y), yMax]; | ||
} else { | ||
return [xMax, Math.floor(xMax * y / x)]; | ||
return [xMax, Math.round(xMax * y / x)]; | ||
} | ||
@@ -63,8 +63,8 @@ | ||
// Width given, height automagically selected to preserve aspect ratio. | ||
return [xMax, Math.floor(xMax * y / x)]; | ||
return [xMax, Math.round(xMax * y / x)]; | ||
} else { | ||
// Height given, width automagically selected to preserve aspect ratio. | ||
return [Math.floor(yMax * x / y), yMax]; | ||
return [Math.round(yMax * x / y), yMax]; | ||
} | ||
}; |
{ | ||
"name": "aspectratio", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Image aspect ratio utility", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -45,2 +45,7 @@ var assert = require('assert'); | ||
}); | ||
it('properly rounds all edges', function() { | ||
var bounds = aspect.resize(800, 534, 500, 500); | ||
assert.deepEqual(bounds, [ 500, 334 ]); | ||
}); | ||
}); | ||
@@ -47,0 +52,0 @@ }); |
13815
256