Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add ne and sw to bounds object - #287

Merged
istarkov merged 4 commits into
GoogleMapReact:masterfrom
sleekybadger:feature/add-ne-sw-to-bounds
Nov 30, 2016
Merged

istarkov merged 4 commits into
GoogleMapReact:masterfrom
sleekybadger:feature/add-ne-sw-to-bounds

Conversation

@sleekybadger

Copy link
Copy Markdown
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
Copy Markdown
Member

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

@istarkov

Copy link
Copy Markdown
Member

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

@sleekybadger

Copy link
Copy Markdown
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
Copy Markdown
Member

Super!

@sleekybadger

Copy link
Copy Markdown
Contributor Author

@istarkov cool, i'll push changes tomorrow morning

@istarkov

Copy link
Copy Markdown
Member

Thank you!

@sleekybadger

Copy link
Copy Markdown
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
Copy Markdown
Member

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

@sleekybadger

Copy link
Copy Markdown
Contributor Author

@istarkov done!

Comment thread src/utils/utils.js Outdated
};
}

const exports = {

@istarkov istarkov Nov 30, 2016

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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 GoogleMapReact:master Nov 30, 2016
@istarkov

Copy link
Copy Markdown
Member

At npm [email protected]

@sleekybadger

Copy link
Copy Markdown
Contributor Author

Cool, glad that i helped 😉

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

lock Bot commented Dec 1, 2019

Copy link
Copy Markdown

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