Open pct-elizabeta-dimovska opened 9 months ago
Hi, this works for me in the demo. Select draw_circle
in the mode select, draw a circle, the mode switches back to simple_select.
Can you debug what's specific in your setup?
your demo throws this error with any interaction after initial draw:get_features_and_set_cursor.js:14 Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at N (get_features_and_set_cursor.js:14:18) at i.mouseup (events.js:63:20) at Ct.fire (evented.js:119:26) at i.fire (setup.js:53:24) at Oo.mouseup (map_event.js:38:19) at gr.handleEvent (handler_manager.js:325:58)
Hi, I think I'm running into a similar issue. I've tried the demo as well in Chrome, Firefox, and Safari, and on Linux and MacOS. The demo for me shows non-geodesic lines whenever a mode that's not the draw_circle is selected:
The object also has an extra field which is "undefined".
In this code: https://github.com/zakjan/mapbox-gl-draw-geodesic/blob/master/src/modes/index.js#L11-L22 what is happening when I step through the browser's debugger is patchDrawLineString(modes[Constants.modes.DRAW_LINE_STRING])
calls the patch function with undefined
presumably because Constants.modes.DRAW_LINE_STRING is undefined.
Hi, the root cause was in incorrect reading existing mapbox-gl-draw modes after upgrading to mapbox-gl-draw 1.4.3. Fixed in https://github.com/zakjan/mapbox-gl-draw-geodesic/commit/f6ca244aa973160c69941ae4850e8d86771ec8d1 and released as 2.3.1. Could you try it?
Hi this fix seems to work for me, thanks! I figured it was something better than my hardcoded solution but I'm not as familiar with the mapbox library.
When the user draws a circle, after the shape is created the mode needs to be changed to simple select, but instead an error is thrown:
Console error
The code is trying to access
Constants.modes.SIMPLE_SELECT
Constant
modes
doesn't contain property with keySIMPLE_SELECT
- it's in lower case.