fil*_*ter 12 javascript google-maps-api-3 google-maps-markers
我正在使用此功能向地图添加新标记(和折线):
function addMarker(location) {
path = poly.getPath();
path.push(location);
marker = new google.maps.Marker({
position: location,
icon:'location.png',
title: poly.inKm() + ' km',
map: map
});
markersArray.push(marker);
}
Run Code Online (Sandbox Code Playgroud)
如何删除最后一个标记(用于实现撤消)?
最好的祝福 ...
reb*_*mer 17
markersArray[markersArray.length-1].setMap(null);
Run Code Online (Sandbox Code Playgroud)
...为路径:
path = poly.getPath();
path.pop();
Run Code Online (Sandbox Code Playgroud)