1
在下面的plunker中,我可以通過選擇多邊形工具來添加如此多的多邊形。但我需要限制它只有一個。添加一個多邊形後,它應該禁用,或者用戶不應該能夠在地圖上放置另一個多邊形。 我已經使用ngMap https://ngmap.github.io/。將動態矩形限制爲一個
幾乎相同的副本limit the dynamic markers to one。但我無法做矩形。
<ng-map zoom="13" center="37.774546, -122.433523"
map-type-id="ROADMAP"
street-view-control-options="{position: 'LEFT_CENTER'}">
<drawing-manager on-overlaycomplete="onMapOverlayCompleted()"
drawing-control-options="{{drawingControlOptions}}"
drawingControl="true"
drawingMode="null"
rectangleOptions="{fillColor:'red'}"
circleOptions="{fillColor: '#FFFF00',fillOpacity: 1,strokeWeight: 5,clickable: false,zIndex: 1,editable: true}">
</drawing-manager>
</ng-map>
謝謝。有效。這麼小的事情花了一些時間給我 – codelearner