mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-18 15:54:22 +00:00
Docs: fix error in code (#2012)
Co-authored-by: Xiaoji Chen <Pessimistress@users.noreply.github.com>
This commit is contained in:
parent
6213d5758a
commit
c8d0401bb7
@ -184,7 +184,7 @@ const mapRef = useRef<MapRef>();
|
||||
|
||||
const checkIfPositionInViewport = (lat, lng) => {
|
||||
const bounds = mapRef.current.getMap().getBounds();
|
||||
return (lat >= bounds._sw.lat && lat <= bounds._nw.lat && lng >= bounds._sw.lng && lng <= bounds._nw.lng);
|
||||
return bounds.contains([lng, lat]);
|
||||
}
|
||||
|
||||
return <Map ref={mapRef} [..]/>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user