You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using both a trigger to draw on the map and a draw control:
let isDrawing = false;
// Setup for TerraDraw
const draw = new TerraDraw({
adapter: new TerraDrawMapLibreGLAdapter({ map: map.current }),
modes: [new TerraDrawRectangleMode()],
});
// Function to toggle drawing
function startDrawing() {
if (!isDrawing) {
draw.start();
draw.setMode("rectangle");
isDrawing = true; // Set the drawing state to true
}
}
// Call startDrawing when you need to initiate drawing
startDrawing();
After using the draw trigger, when I try to add a polygon with the draw control, I encounter an error: "Source 'td-point' already exists."
It may be necessary to check if the source has already been added to MapLibre on draw control.
Bug Reproduction
No response
Bug Screenshots
No response
Bug System Information
OS: [e.g. Windows 10]
Browser: [e.g. Google Chrome, Firefox]
The text was updated successfully, but these errors were encountered:
drawControl=newMaplibreTerradrawControl({modes: ['render','point','linestring','polygon','rectangle','circle','freehand','angled-rectangle','sensor','sector','select','delete-selection','download'],open: true,});map.current.addControl(drawControl);terradraw=drawControl.getTerradrawInstance()// do your own coding and settings for terradraw instance itself.
you can subscribe events from terradraw directly, or plugin also has own on method to subscribe an event.
currently the plugin only has two types of events ( "mode-changed" | "feature-deleted"), but feel free to make a PR to add other type of event type to the plugin.
Select items which related to this issue
maplibre-gl-terradraw
Bug Description
Using both a trigger to draw on the map and a draw control:
And draw control
After using the draw trigger, when I try to add a polygon with the draw control, I encounter an error: "Source 'td-point' already exists."
It may be necessary to check if the source has already been added to MapLibre on draw control.
Bug Reproduction
No response
Bug Screenshots
No response
Bug System Information
The text was updated successfully, but these errors were encountered: