Skip to main content

Pin Helper Mode

The Pin Helper Mode allows you to "pin" markers or vertices together, enabling synchronized movement of all connected points when any one of them is dragged. This mode is useful for maintaining alignment across features that share the same coordinates.

You can enable Pin Helper Mode with the following methods:

map.gm.enableMode('helper', 'pin');
map.gm.disableMode('helper', 'pin');
map.gm.toggleMode('helper', 'pin');
map.gm.isModeEnabled('helper', 'pin');

Events for Pin Helper Mode

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:globalpinmodetoggledeventFired when Pin Helper Mode is toggled.enabled, map

Example Usage

You can listen for specific Pin Helper Mode events on the map instance like this:

map.on('gm:globalpinmodetoggled', (event) => {
console.log(event);
});

Behavior

When Pin Mode is enabled:

  1. Synchronized Movement: Dragging a marker or vertex will move all other markers/vertices with the same coordinates (latLng) in sync.
  2. Automatic Pinning: This functionality is applied to any markers or vertices at identical coordinates, automatically linking them.

Live Pinning Example