Skip to main content

Customize Style

Customize Style

To customize the style of the drawn layer with leaflet options, you can either pass the options to enableDraw or set the options generally:

map.pm.setPathOptions({
color: "orange",
fillColor: "green",
fillOpacity: 0.4,
});

If you want to exclude shapes from receiving these path options, use the second parameter like this:

map.pm.setPathOptions(
{ color: "orange" },
{
ignoreShapes: ["Circle", "Rectangle"],
}
);

You can also merge the new style with the current one, if you pass the parameter merge: true:

map.pm.setPathOptions(
{ color: "orange" },
{
merge: true,
}
);