How to remove autofocus on rendered elements in Leaflet?

  • 0
    Good afternoon, I have a non-geographic map (like an example from the docks). I use a promise to take the coordinates of the polylines in JSON from the service and draw them. but for some reason the map does some kind of autofocus on the last rendered element.
    I read that there is a certain autoPan, but this is for pop-ups, so it's not about my case. Yes, I distribute popups on polylines and polygons that I draw - I do bindPopup and specially placed autoPan: false everywhere. However, this does not help, since, most likely, this is not the case.
    If I draw polylines, then I start drawing polygons - the same story, the focus will be on the last one drawn. We need to get rid of it somehow.
    Who has experience?
    Help anyone who can.
    JavaScript Finn Lee, Oct 23, 2020

  • 1 Answers
  • 0
    Well, that is, not "it itself", but you yourself.

    map.fitBounds (polygon.getBounds ());

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!