Makes it possible to draw donuts with L.Donut
on Leaflet maps.
It extends L.Circle
and adds a inner radius. Look into the Demo.
var donut = L.donut(map.getCenter(),{
radius: 2000,
innerRadius: 1000,
innerRadiusAsPercent: false,
}).addTo(map);
Download L.Donut.js and include them in your project.
<script src="./src/L.Donut.js"></script>
or use the script over cdn:
<script src="https://cdn.jsdelivr.net/gh/Falke-Design/L.Donut@latest/src/L.Donut.js"></script>
You can use new L.Donut
or the factory L.donut
.
Method | Returns | Description |
---|---|---|
L.donut(latlng ,options ) |
this |
Creates the Donut shape. |
setInnerRadius(radius ) |
this |
Sets the inner radius of a circle. Units are in meters or percent. The outer radius must be greater then the inner radius. |
getInnerRadius() | Number |
Returns the current inner radius of a circle. Units are in meters or percent. |
Option | Description |
---|---|
radius | Outer radius. The outer radius must be greater then the inner radius. |
innerRadius | Inner radius. It can be a meter value or a percent (0-1) value of the outer radius. |
innerRadiusAsPercent | Default false . Defines if the inner radius is a percent value of the outer radius. |
<L.Circle options> |
Other L.Circle options: Docs |