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:
Event | Params | Description | Output |
---|---|---|---|
gm:globalauto_tracemodetoggled | event | Fired 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:
- Calculates the shortest path between two specified points.
- Adds intermediate points along the traced path if needed to maintain shape accuracy.