1

I am trying to use Leaflet.pm library (https://github.com/codeofsumit/leaflet.pm). I wanted to know if its possible to add additional icons to the toolbar. For example, there is standard polyline icon but I would like to add another polyline which has a dashed style line. Tia

Falke Design
  • 10,635
  • 3
  • 15
  • 30
user2018413
  • 91
  • 1
  • 5

1 Answers1

1

I'm Sumit, the maintainer of leaflet.pm

The icons are added as background-image through CSS classes. The CSS class for polyline is leaflet-pm-icon-polyline. You can simply inspect the buttons with your developer tools in the browser to see the details.

To change an image, apply a different background-image to the buttons CSS class like this:

.leaflet-pm-icon-polyline {
  background-image: url("path/to/myOtherIcon.png") !important;
}

It's not specifically documented because it is not a feature of leaflet.pm - it is standard CSS behaviour. Hope this helps anyway!

ProblemsOfSumit
  • 19,543
  • 9
  • 50
  • 61
  • Thanks for replying. I was actually interested to know if I could add additional icons to the toolbar via options. For example, I want a red polyline, a green polyline, a green alt polyline etc. Is that possible? – user2018413 May 02 '19 at 06:30
  • It is but I haven't exposed a specific API for it so you'd have to go into Leaflet.pm territory and use L.Control. Might be a bit of a hassle. Would your usecase also be solved by adding a style-chooser to leaflet.pm that lets the user change layer styles, colors, etc? In either way, feel free to open a feature request here: https://github.com/codeofsumit/leaflet.pm – ProblemsOfSumit May 02 '19 at 18:06
  • Yes my use case would be to have a style-chooser. I am tying to do it myself by adding my own style-chooser during pm:drawstart event. Its very basic but if it works for me then I won't need the feature request. Thank you again for reaching out – user2018413 May 10 '19 at 07:52