Options
Options
You have many options available when drawing and editing your layers (described above).
You can set the options per layer as described above, or you can set them globally for all layers. This is especially useful when you use the toolbar and can't change the options programmatically.
Examples:
layer.pm.enable({ pinning: true, snappable: false });
map.pm.setGlobalOptions({ pinning: true, snappable: false });
The following options are additionally to the Draw and Edit Mode options.
| Option | Default | Description |
|---|---|---|
| snappingOrder | Array | Prioritize the order of snapping. Default: ['Marker','CircleMarker','Circle','Line','Polygon','Rectangle']. |
| layerGroup | map | add the created layers to a layergroup instead to the map. |
| panes | Object | Defines in which panes the layers and helper vertices are created. Default: { vertexPane: 'markerPane', layerPane: 'overlayPane', markerPane: 'markerPane' }. |
| cutAsCircle | false | Enable cutting in shape form of a Circle. |
| exitModeOnEscape | false | When enabled, pressing the Escape key will deactivate any active mode (drawing, edit, drag, removal, rotate, cut). |
| finishOnEnter | false | When enabled, pressing the Enter key will finish drawing Line (2+ vertices) and Polygon (3+ vertices) shapes. |
The following events are available on a map instance:
| Event | Params | Description | Output |
|---|---|---|---|
| pm:globaloptionschanged | e | Fired when global options are changed. |
Some details about a few more powerful options: