dev-event / react-native-maps-draw

Interactive drawing of polygons on the map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Draw event still occurs when "isDrawMode" = false

TheHuns opened this issue · comments

Issue:
I am using something close to the basic example shown. When I have 'isDrawMode" set to false and swipe on the map the line is still drawn.

Expected behavior:
When "isDrawMode" is set to false I would expect to be able to pan and zoom around the map, then toggle draw mode on when ready to create a polygon.

Is there another prop I am missing that needs to be used in conjunction with this one?

Thanks! Love the project and hope it's going well for you! First thing like it I have found for RN and much needed in my project.

Also, somewhat unrelated but the line being drawn is above and slightly to the right from where the press is happening, is this the expected behavior?

@TheHuns Hello =) look at the variables modePolygon(responsible for the drawing mode) and isDrawMode(has anything drawn).
not exact coordinates when drawing, we cannot correct it. You can try replacing this method with a better one:
async (item) => await mapRef.current?.coordinateForPoint(item),

Think I figured it out after some testing. Seems like I needed the following settings to be able to pan or zoom

scrollEnabled={true}
 isDrawMode={false}
 createdPolygon={true}

Which doesn't make a whole lot of sense given the labels for these properties.

Will take a look at the method, thanks!

If you need help, please contact. I did this project for myself, but it is starting to gain popularity

@dev-event Hello! I sent an email regarding a PR for a small fix for this issue i mentioned above.

Also, somewhat unrelated but the line being drawn is above and slightly to the right from where the press is happening, is this the expected behavior?

Seems just to be a side effect when the map is not fullscreen (I have a header on that page) and the canvas is still trying to be sized to the device window.

Let me know what I can do to help, Thanks!

@TheHuns hi.
Yes, this is a side effect. This can be corrected by adding an error to x and y in advance.