Snap Guides ⭐
Snap Guides ⭐
Snap Guides are a powerful tool to create precise geometries. They are especially useful when drawing or editing shapes. Exclusive for Leaflet-Geoman Pro ⭐
Snap Guides are guides that help you to align your shapes. They are displayed as dashed lines and snap to the orthogonal direction (90°) of the current vertex line.
Snap Guides are disabled by default. You can enable them by setting showSnapGuides
to true
in the global
options.
map.pm.setGlobalOptions({
showSnapGuides: true,
});
Custom Snap Guide Angles
You can also define custom snap guide angles. The default snap guide angles are [0, 90, 180, 270]
. You can define your custom angles by setting snapGuidesAngles
in the global
options.
map.pm.setGlobalOptions({
showSnapGuides: true,
snapGuidesAngles: [30,45,60,75,90]
});
Snap Guide Button in the Toolbar
You can also enable/disable a button to the toolbar to toggle snap guides. You can enable (disable) it by setting showSnapGuideButton
to true
(false
) in the addControls
options.
map.pm.addControls({
snapGuidesOption: true,
});
Examples
SnapGuides enabled with default angles of snapGuidesAngles={[90]}
:
SnapGuides enabled with default angles of snapGuidesAngles={[45,60,90]}
:
SnapGuides enabled with default angles of snapGuidesAngles={[45,60,90]}
:
SnapGuides enabled with default angles of snapGuidesAngles={[15,30,45,60,75,90]}
: