#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:
Ivan 2016-07-24 21:40:32 +03:00 committed by Ivan Starkov
parent 7c17379886
commit 7c8ec7a2bb
3 changed files with 20 additions and 2 deletions

View File

@ -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);

View File

@ -170,7 +170,7 @@ export default class GoogleMapMarkers extends Component {
}
}
_onMouseChangeHandler_raf = () => {
_onMouseChangeHandler_raf = () => { // eslint-disable-line
if (!this.dimesionsCache_) {
return;
}

View File

@ -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,
},
};
},