If the point is visible on the map

How do I know if a dot is visible on my map?

var point = new google.maps.LatLng (parseFloat (lat), parseFloat (lng)); if map.getbounds () contains (dot) ...

+4
source share
1 answer

If the value is visible, if the point is inside the visible area of ​​the map (viewport);

// assuming you initialized your map var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng)); var currentBounds = map.getBounds() // get bounds of the map object viewport if(currentBounds.contains(point)){ // your location is inside your map object viewport }else{ // your location is out of the bounds of the map visible viewport } 
+7
source

All Articles