在Google Maps V3中,是否有一种方法可以检查标记是否实际存在于地图上?
我有一些会在点击后消失的标记。我想要一些逻辑来检查标记当前的可见性。
例如:
var start_marker = null;
start_marker = new google.maps.Marker({ position: location, map: map, clickable: true });
google.maps.event.addListener(start_marker, 'click', function(event) {
start_marker.setMap(null);
});
// ... Later in code: check whether marker is currently visible.
console.log('Type of start_marker is now: ' + typeof(start_marker));
我本以为当标记不可见时,这会给我一个 null 类型,但实际上它仍然是一个对象。
那么,还有什么其他方法可以检查此特定标记是否在地图上可见?
谢谢!
start_marker=null
,但我想知道是否有内置的方法! - simon