看这段代码:这是一个谷歌工具,可以在地图上创建一个面板,帮助我们绘制形状。通过drawingMode: google.maps.drawing.OverlayType.CIRCLE
我们可以指示在第一次加载时选择了哪个工具,但我想在程序中更改它。例如,我想通过单击按钮将 CIRCLE 更改为 POLYGON。我怎么能做这样的事情?
drawingManager = new google.maps.drawing.DrawingManager({
drawingMode: google.maps.drawing.OverlayType.CIRCLE,
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: [google.maps.drawing.OverlayType.CIRCLE,
google.maps.drawing.OverlayType.RECTANGLE,
google.maps.drawing.OverlayType.POLYGON
]
}
});