diff --git a/develop/tests/playground.spec.js b/develop/tests/playground.spec.js index fcb3aec0..1126d814 100644 --- a/develop/tests/playground.spec.js +++ b/develop/tests/playground.spec.js @@ -10,7 +10,7 @@ describe('Playground', () => { const props$ = (new BehaviorSubject(1)) .distinctUntilChanged(comparator); - props$.subscribe(v => console.log(v)); + props$.subscribe(v => console.log(v)); // eslint-disable-line props$.next(1); props$.next(2); props$.next(1); diff --git a/src/google_map_markers.js b/src/google_map_markers.js index fdc6af25..6a55154a 100644 --- a/src/google_map_markers.js +++ b/src/google_map_markers.js @@ -170,7 +170,7 @@ export default class GoogleMapMarkers extends Component { } } - _onMouseChangeHandler_raf = () => { + _onMouseChangeHandler_raf = () => { // eslint-disable-line if (!this.dimesionsCache_) { return; } diff --git a/src/utils/utils.js b/src/utils/utils.js index b4c06846..c8089712 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -91,9 +91,27 @@ const exports = { y: 0.5 * (nwWorld.y + seWorld.y), }; + const scale = Math.pow(2, zoom); + const halfW = width / scale / GOOGLE_TILE_SIZE / 2; + const halfH = height / scale / GOOGLE_TILE_SIZE / 2; + + const newNW = world2LatLng({ + x: middle.x - halfW, + y: middle.y - halfH, + }); + + const newSE = world2LatLng({ + x: middle.x + halfW, + y: middle.y + halfH, + }); + return { center: world2LatLng(middle), zoom, + newBounds: { + nw: newNW, + se: newSE, + }, }; },