map.invalidateSize() leaves map._sizeChanged hangingΒ #2249
Description
https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L236
this._sizeChanged
is set to true, but then the function returns, when a map is not yet ready. Result: after some time map.getSize()
returns actual size (because _sizeChanged
is true), but map size is not invalidated, and subsequent call to map.invalidateSize()
does nothing.
Note that this happens only in IE8 (and possibly IE7), because invalidateSize()
is called from window.onresize
listener. In IE8 that event is fired when any element on the page is resized.
In my case, I used map.getSize()
to get map panel dimensions as Leaflet stored them, compared them to actual dimensions and called both invalidateSize()
and my own updating method if those dimensions are different. This issue breaks the updating in IE8.
Supposed fix: either check for this._loading
in _onResize()
method, or move _sizeChanged = true
after a _loading
check.
Activity