문제

I have a Google Map already zoomed and positioned. How can I find out if some coordinates are within the map bounds or viewport of the current map? I want to conditionally drop a pin only if the coordinates I feed it is within the current bounds.

도움이 되었습니까?

해결책

google.maps.LatLngBounds.contains()

(from the documentation):

contains
contains(latLng)
Parameters:
latLng: LatLng|LatLngLiteral
Return Value: boolean
Returns true if the given lat/lng is in this bounds.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top