问题
how can i change default toolbar icon to something else on leaflet..
picture above show the default view of icon.. i want to customize and change the icon to something else for example the first icon i want to look like as a bridge and second text icon and so on..
i already tried a few ways but did not work.
here my code
var electricpole = L.Icon.extend({
options: {
shadowUrl: null,
iconAnchor: new L.Point(12, 12),
iconSize: new L.Point(30,30),
iconUrl: 'image/electricpole.png'
}
});
L.DrawToolbar.include({
getModeHandlers: function(map:L.Map) {
return [
{
enabled: true,
handler: new L.Draw.Polyline(map),
title: 'Draw Polyline'
},
{
enabled: true,
handler: new L.Draw.Polygon(map),
title: 'Draw Polygon'
},
{
enabled: true,
handler: new L.Draw.Rectangle(map),
title: 'Draw Rectangle'
},
{
enabled: true,
handler: new L.Draw.Circle(map),
title: 'Draw Circle'
},
{
enabled: true,
handler: new L.Draw.Marker(map, {
icon: new electricpole,
html: '🖈',
}),
title: 'Place electric pole marker'
},
];
}
});
my code show variable electricpole
should change icon from into 🖈.. but i try did not work... can somebody help me how to change it.
来源:https://stackoverflow.com/questions/44381913/change-default-icon-toolbar-leaflet