Add ne and sw to bounds object by sleekybadger · Pull Request #287 · google-map-react/google-map-react

@sleekybadger

Hi, thanks for the great library it serving to me faithfully not first time.

I found small problem with bounds object, most geo tools expect to receive data with NE and SW, instead of NW and SE. So i thought it will be cool if bounds object will contain all corners.

@sleekybadger

@istarkov

Hi thank you, fully agree. Will check PR later today or tomorrow.

@istarkov

All is fine, may be add ability to use NE SW (if NW SE is not provided) to documented fitBounds ?

@sleekybadger

@istarkov It's make sense, what do you think about such approach:

  1. If we have NW and SE we're just using them.
  2. If we have NE and SW we're converting them into NW and SE and using same algorithm that we have in fitBounds method.

@istarkov

@sleekybadger

@istarkov cool, i'll push changes tomorrow morning

@istarkov

@sleekybadger

@sleekybadger

@istarkov hm, I thought a little bit about it today, and i don't really like that we're passing NE and SW to fitBounds, but it returns NW and SE. What do you think about it?

Also i think will can add some helpers like convertNeSwToNwSe and convertNwSeToNeSw, cause we're repeating this logic in few places.

@istarkov

Agree that newBounds must have all corners,
any your decision on convertXXX2YYY will be good.

@sleekybadger

@sleekybadger

istarkov

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we will remove const exports = and all that this below, as it was time when export default { blabla } was the same as export const blabla
Having that it was deprecated in babel there is no need in exports object at all.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that part seemed strange to me) Sure.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@sleekybadger

@istarkov

Super,
from first days I had knowledge that bounds object is not similar to others API
(and my laziness didn't allow me to fix that)

all that my

  const ne = { lat: nw.lat, lng: se.lng };
  const sw = { lat: se.lat, lng: nw.lng };
  return new LatLngBounds(sw, ne);

now will gone ;-)

Thank you a lot!!!!

@istarkov

At npm google-map-react@0.22.0

@sleekybadger

Cool, glad that i helped 😉

@lock

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators

Dec 1, 2019