loleaflet/src/map/Map.js | 9 +++++++++ 1 file changed, 9 insertions(+)
New commits: commit dc4177326771dc2d280ddbba1f4ba88e426742c2 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Sat Jul 13 10:22:39 2019 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Tue Aug 20 17:25:42 2019 +0200 loleaflet: mobile: apply auto fit width zooms when doc layer is loaded When the leaflet.html is loaded, it fires the resize event, at that instant the map does not exist nor the document layer. Once the objects are properly initialized fire again resize to apply fit width zoom. Change-Id: Ib8c149ca4ff20006884ad567f387d81d9d3086e1 Reviewed-on: https://gerrit.libreoffice.org/77845 Reviewed-by: Henry Castro <hcas...@collabora.com> Tested-by: Henry Castro <hcas...@collabora.com> diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 78602aa4e..5b048ac2a 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -190,6 +190,11 @@ L.Map = L.Evented.extend({ } }, this); this.on('doclayerinit', function() { + if (window._invalidateSize) { + this._size = new L.Point(0,0); + this._onResize(); + delete window._invalidateSize; + } if (!this.initComplete) { this._fireInitComplete('doclayerinit'); } @@ -1021,6 +1026,10 @@ L.Map = L.Evented.extend({ }, _onResize: function () { + if (!this || !this._docLayer) { + window._invalidateSize = true; + return; + } L.Util.cancelAnimFrame(this._resizeRequest); this._resizeRequest = L.Util.requestAnimFrame( function () { this.invalidateSize({debounceMoveend: true}); }, this, false, this._container); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits