Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error while deleting points after resume measure #100

Closed
EyalYahav opened this issue Jan 5, 2023 · 4 comments
Closed

error while deleting points after resume measure #100

EyalYahav opened this issue Jan 5, 2023 · 4 comments

Comments

@EyalYahav
Copy link

hello, I've noticed an error while resuming the measure and try to delete a point. The error is:
Uncaught TypeError: Cannot read properties of undefined (reading 'lat')
at Object.distance (CRS.Earth.js:26:22)
at v.distanceTo (LatLng.js:76:16)
at e. (Leaflet.PolylineMeasure.js:1355:93)
at Array.map ()
at e._dragCircle (Leaflet.PolylineMeasure.js:1353:57)
at e.fire (Events.js:195:9)
at e._fireDOMEvent (Map.js:1452:15)
at e._handleDOMEvent (Map.js:1401:8)
at HTMLDivElement.o (DomEvent.js:108:13)

it occurs also on the demo site https://ppete2.github.io/Leaflet.PolylineMeasure/demo1.html
Is there any way to overcome this error?

thanks :)

@EyalYahav EyalYahav changed the title error while deleting points after continue measuring error while deleting points after resume measure Jan 5, 2023
@ppete2
Copy link
Owner

ppete2 commented Jan 5, 2023

You're right, I'll try to figure out the problem

@Grawl
Copy link
Contributor

Grawl commented Jan 13, 2023

Can confirm that issue

@cbVirginia
Copy link

I have a solution for when points are deleted. The _arrPolylines array needs to be re-indexed after a line segment is removed. Like this:
image
Addition is in green.

@ppete2
Copy link
Owner

ppete2 commented Jun 21, 2023

@cbVirginia Thanks, but I'm afraid your solution isn't working, at least not in all cases. For example:
Draw a line with 3 points. Then resume this line and delete the 2nd point of the line => error messege in console appears
Any idea?

ppete2 added a commit that referenced this issue Aug 5, 2023
@ppete2 ppete2 closed this as completed Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants