0
我正在使用傳單應用,用戶在其中繪製某些形狀。 使用leaflet.polyline.decorators將多段線添加到該形狀。 我只想知道如何將自定義標記傳遞給L.Symbol.marker()。如何將自定義標記傳遞給多段線裝飾器
例如,我傳遞自定義標記,但它不工作。
腳本
var myCustomMarker= L.icon({
iconUrl: 'assets/img/wallE.png',
iconSize: [30, 30], // size of the icon
iconAnchor: [5, 18], // point of the icon which will correspond to marker's location
});
new L.Marker(e.latlng, { icon: wallIcon, draggable: false }).addTo(curr);
polylineWall.addLatLng([e.latlng.lat,e.latlng.lng]).addTo(curr);
// Add coordinate to the polyline
var decorator = L.polylineDecorator(polylineWall, {
patterns: [
{ offset: 0, endOffset: 0, repeat: '10px', symbol: new L.Symbol.marker(myCustomMarker)}
]
}).addTo(curr);
控制檯錯誤
Uncaught Error: iconUrl not set in Icon options (see the docs).
如果有人對這個問題您的時間,請help.Thanks知識。
是的,完美的,謝謝你的幫助 –