This is fork of slutske22/leaflet-arrowheads focussed on simplicity.
Instead of drawing decorations on a Polyline in creates a new class Arrow with simplified options and constant size across zoom levels.
Leaflet-Arrowheads is compatible with leaflet v2.
Arrowheads can be applied to any polyline, whether unisegmental, multisegmental, continuous, or discontinuous:
let myArrow = new Arrow([coords]);Arrows can take a configuration object as its argument:
let myArrow = new Arrow([ coords ], { <Options> });Arrows offer a variety of options for rendering and styling arrowheads. See the options table below.
Arrows inherit all options from Polyline.
Arrows also inherit all options from their parent polylines, except fill, fillOpacity, and smoothFactor.
These can be changed manually when defining the arrowheads' options, but changing smoothFactor will result in improperly rendered arrows.
| Option | Type | Default | Description |
| yawn | Number ( Degrees ) | 60 | Defines the width of the opening of the arrow head, given in degrees. The larger the angle, the wider the arrowhead. |
| headFill | Boolean | false | Defines if the arrow head is filled with color or not. |
See file in example folder.
Arrowheads sometimes look like they're in slightly the wrong orientation in areas of high curvature. This is because of the way leaflet-arrowheads chooses and interpolates the points that it uses to calculate bearings. This may be able to be improved. Feel free to contribute / open a PR.