Leaflet/Leaflet.Editable

Middle-markers shift away from the lines on zooming

glebshalyganov opened this issue · 4 comments

Hello!

Test-case:

  1. Open the demo UI. Zoom out for 7-8 times.
  2. Draw complex polygon with many nearby points. Something like this:
    image
  3. Zoom out a few times so that middle-markers disappear.
  4. Drag the polygon to another place:
    image
  5. As we zoom in, we can see how middle-markers are shifting away from the lines:
    image

I had a similar issue.

The thing is that the positions are INITIALLY calculated in integers (x,y) due to being screen positions not lat and longs.

I didn't have a zoom on my map (as was assuming that the bounds setting sets the right zoom anyway)

IF you default to zoom 18 on the map itself before you add the polygon, it will then still do integer calculations (but will be super accurate), then will rebound to the right zoom / bounds anyway

Took me a little while to work this out!

@alexbainbridge thank you for the reply!
I think since the visibility of the middle markers is recalculating on each zoom, it might be reasonable to also recalculate the position of the middle markers as well. I'm not sure if it will significally worsen the performance, but at least it will fix the problem for sure.

Hi. Any update or workaround about this issue?

Hi. Any update or workaround on this issue?