Skip to content

Commit

Permalink
Ensure fitBounds doesn't return NaN zoom value (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwarning authored and abmai committed Dec 9, 2016
1 parent 1761a2c commit b4e4605
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/fit-bounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function fitBounds(width, height, bounds, {
const scaleY = (tr.height - padding * 2 - Math.abs(offset.y) * 2) / size.y;

const center = tr.unproject(nw.add(se).div(2));
const zoom = tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY));
const zoom = tr.scaleZoom(tr.scale * Math.abs(Math.min(scaleX, scaleY)));
return {
latitude: center.lat,
longitude: center.lng,
Expand Down

0 comments on commit b4e4605

Please sign in to comment.