Skip to main content

Auto Trace Helper Mode

The Auto Trace Helper Mode assists users in drawing and connecting shapes by automatically tracing the shortest path between selected points. This mode can be applied to create or complete shapes like lines and polygons by tracing along existing paths.

You can enable Auto Trace Helper Mode with the following method:

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

Events for Auto Trace Helper Mode

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:globalauto_tracemodetoggledeventFired when Auto Trace Mode is toggled.enabled, map

Example Usage

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

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

Behavior

Auto tracing works with the following shape types:

  • Lines
  • Polygons
  • Rectangles
  • Circles

The Auto Trace Helper:

  1. Calculates the shortest path between two specified points.
  2. Adds intermediate points along the traced path if needed to maintain shape accuracy.

Live Auto Trace Example