Reputation: 43
I need to create a custom Marker
class in Leaflet: the marker must include a direction arrow. The arrow size should not depend on a zoom level. The direction should be editable (the arrow head should be draggable itself).
It was pretty easy to create a class and draft basic editing and events. And now...
Polyline
and changing its end coordinate every time a zoom changes. I believe there should be a way to "just draw a line in pixel coordinates", but the abstractions there are too deep to dive recklessly - things like L.Browser.ie
are pretty scary. Can anyone please tell me, is there a better way to draw an arrow, or should I go with Polyline
?Icon
itself (that's what I do now)? Or is there a layer/extension that can apply dragging without creating a map object?Thanks.
Upvotes: 3
Views: 15339
Reputation: 1
Use plugin https://www.npmjs.com/package/leaflet-canvas-markers You can create a direction arrow by simply pointing to the previous waypoint! Or set custom rotate.
Upvotes: 0
Reputation: 3124
You can do this by using plain .png
icons.
http://codepen.io/anon/pen/qJbgm
Upvotes: 2