是否可以欺骗我的Google Map单击双击事件?
默认情况下,双击时,它会放大,我想单击一次。
。function initMap() {
var myLatlng = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: myLatlng
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Click to zoom'
});
map.addListener('center_changed', function() {
// 3 seconds after the center of the map has changed, pan back to the
// marker.
window.setTimeout(function() {
map.panTo(marker.getPosition());
}, 3000);
});
marker.addListener('click', function() {
map.setZoom(8);
map.setCenter(marker.getPosition());
});
}
for marker.addlistener('click',function(){});
可能会欺骗我的计算机将其视为双击?
添加
怎么办map.addListener('click', function(e) {
map.setZoom(12); // zoom
map.setCenter(e.latLng); // center
});
您也可以放大:
map.setZoom(map.getZoom() + 1);
或类似的 panTo