S
S
survivalsuit2020-10-19 12:50:09
JavaScript
survivalsuit, 2020-10-19 12:50:09

How to remove autofocus on rendered elements in Leaflet?

Good afternoon, I have a non-geographic map (as an example from the docks). With the help of a promise, I take the coordinates of 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 some kind of autoPan, but this is for popups, so it's not about my case. Yes, I distribute popups to polylines and polygons that I draw - I do bindPopup and specially placed autoPan: false everywhere. However, this does not help, because, most likely, the matter is different.
If I draw polylines, then I start drawing polygons - the same story, there will be focus on the last drawn one. You need to somehow get rid of it.
Who had experience?
Help whoever can.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-10-19
@survivalsuit

Well, that is, not "it itself", but you yourself
map.fitBounds(polygon.getBounds());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question