mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
11 lines
307 B
JavaScript
11 lines
307 B
JavaScript
const ptInSect = (x, a, b) => (x - a) * (x - b) <= 0;
|
|
|
|
export default ({ nw, se }, pt) => {
|
|
const lngs = nw.lng < se.lng
|
|
? [[nw.lng, se.lng]]
|
|
: [[nw.lng, 180], [-180, se.lng]];
|
|
|
|
return ptInSect(pt.lat, se.lat, nw.lat) &&
|
|
lngs.some(([lngFrom, lngTo]) => ptInSect(pt.lng, lngFrom, lngTo));
|
|
};
|