mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
#add newBounds to fitBounds utils (#202)
* #add newBounds to fitBounds utils * #fix by lint rules * remove npm debug.log * #fix eslint by disable lines
This commit is contained in:
parent
7c17379886
commit
7c8ec7a2bb
@ -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);
|
||||
|
||||
@ -170,7 +170,7 @@ export default class GoogleMapMarkers extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
_onMouseChangeHandler_raf = () => {
|
||||
_onMouseChangeHandler_raf = () => { // eslint-disable-line
|
||||
if (!this.dimesionsCache_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -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,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user