mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
add math abs to avoid negative values when calculating zoom (#655)
* add math abs to avoid negative values when calculating zoom * add math.abs with proper styling to pass tests * add math.abs to dx\dy on fitbounds
This commit is contained in:
parent
16236f9d7e
commit
f73e774a45
@ -80,8 +80,8 @@ function fitNwSe(nw, se, width, height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const zoomX = log2(width / GOOGLE_TILE_SIZE / dx);
|
||||
const zoomY = log2(height / GOOGLE_TILE_SIZE / dy);
|
||||
const zoomX = log2(width / GOOGLE_TILE_SIZE / Math.abs(dx));
|
||||
const zoomY = log2(height / GOOGLE_TILE_SIZE / Math.abs(dy));
|
||||
const zoom = Math.floor(EPS + Math.min(zoomX, zoomY));
|
||||
|
||||
// TODO find center just unproject middle world point
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user