Skip to content

setView() kills map when zoom is omitted  #2056

@ddTech

Description

@ddTech

when the setView() method is called without providing the zoom level, L. does not make use of an already set zoom level or a default vaule but causes an exception in _limitZoom() at line 2275 (code: return Math.max(min, Math.min(max, zoom)); ), when Math.min() tries to compare the undefined value with max.

In my case this happens when I initialize the map without actually showing a default location (saving unnecessary requests and load time) and setView() later, when I get a position from the user's input. This differs from all samples that initialize the map showing a default location.
I can get around it by calling setView() with ...getZoom(), but it would be nicer (and safer) if it made use of the already set ._zoom value (which .panTo() does)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions