我如何将默认工具栏图标更改为传单上的其他图标..
上面的图片显示了图标的默认视图。我想自定义图标并将其更改为其他图标,例如我希望第一个图标看起来像桥梁和第二个文本图标等等。
我已经尝试了几种方法但没有成功。
这是我的代码
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.