Closed laurenoldham1202 closed 3 years ago
I'll take a look. There are few open issues about this tolerance calculation.
I just pushed a new release, that I believe fixes this problem https://github.com/bemky/mapbox-gl-draw-freehand-mode/releases/tag/2.1.0
I just pushed a new release, that I believe fixes this problem https://github.com/bemky/mapbox-gl-draw-freehand-mode/releases/tag/2.1.0
Fantastic! This seems to do the trick. :) One caveat is that in my actual code, I had to update my event handlers because this fired both draw.update
and draw.create
for each drawn shape.
Interesting, I assume Mapboxes DrawPolygon
functions the same way. I didn't really change anything that would have changed how events are fired.
Hi there!
I'm trying to use this freehand mode plugin for my project and I'm getting errors at small-scale views, e.g. zoom levels ~0-4.
You can replicate the error in the official plugin demo: https://bemky.github.io/mapbox-gl-draw-freehand-mode/
The console logs the error from @turf/turf/simplify:
The issue stems from the code:
I played around with it locally, and when you take out this tolerance, small-scale drawings work, BUT large-scale (zoomed-in) drawings now fail.
Is there a way to set the tolerance so that both small and large-scale shapes can be drawn on the map with freehand mode error-free?