alex3165 / react-leaflet-draw

React component for leaflet-draw on top of react-leaflet
228 stars 152 forks source link

Bug EditControl --> shapeOptions, drawError stopped working in v0.20.4 #162

Open Utrehd opened 2 years ago

Utrehd commented 2 years ago

By changing from v0.20.3 to v0.20.4 the onDrawStop event would fire just after the onDrawStart. Not allowing any shape to be drawn.

I found out that this can be negated by removing the shapeOptions : {} and drawError : {} parameters.

Following works with v0.20.3 and not with v0.20.4.

<EditControl
        ...code...
        draw={{
                polyline: false,
                polygon: {
                        metric: true,
                        showArea: true,
                        allowIntersection: false, // Restricts shapes to simple polygons

                        drawError: {
                            color: '#FF5733', // Color the shape will turn when intersects
                            message: '<strong>Polygon!<strong> (allowIntersection: false)' // Message that will show when intersect
                        },
                       shapeOptions: {
                           color: '#BF9000'
                       }

              },
              circle: false, // Turns off this drawing tool
              rectangle: false,
              marker: false,
              circlemarker: false,
        }}