Skip to content

Add ne and sw to bounds object #287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

sleekybadger
Copy link
Contributor

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.

@istarkov
Copy link
Collaborator

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

@istarkov
Copy link
Collaborator

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

@sleekybadger
Copy link
Contributor Author

@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
Copy link
Collaborator

Super!

@sleekybadger
Copy link
Contributor Author

@istarkov cool, i'll push changes tomorrow morning

@istarkov
Copy link
Collaborator

Thank you!

@sleekybadger
Copy link
Contributor Author

@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
Copy link
Collaborator

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

@sleekybadger
Copy link
Contributor Author

@istarkov done!

};
}

const exports = {
Copy link
Collaborator

@istarkov istarkov Nov 30, 2016

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@istarkov
Copy link
Collaborator

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 istarkov merged commit 7a9a8d3 into google-map-react:master Nov 30, 2016
@istarkov
Copy link
Collaborator

At npm google-map-react@0.22.0

@sleekybadger
Copy link
Contributor Author

Cool, glad that i helped 😉

@sleekybadger sleekybadger deleted the feature/add-ne-sw-to-bounds branch November 30, 2016 20:20
@lock
Copy link

lock bot commented Dec 1, 2019

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants