commit 1475918895ff528f1d3286518a5b9cb3cd99ed02
parent 81aea93c48c24e8ea0f57dc690030835380a1b61
Author: Sergey Orlov <wladimirych@gmail.com>
Date: Wed, 6 May 2020 22:22:21 +0200
panoramas: update viewer size on container resize for mapy.cz #379
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/lib/leaflet.control.panoramas/lib/mapycz/index.js b/src/lib/leaflet.control.panoramas/lib/mapycz/index.js
@@ -35,6 +35,7 @@ const Viewer = L.Evented.extend({
this.createDateLabel(container);
this.createCloseButton(container);
window.addEventListener('resize', this.resize.bind(this));
+ this.invalidateSize = L.Util.throttle(this._invalidateSize, 100, this);
},
showPano: function(data) {
@@ -127,6 +128,10 @@ const Viewer = L.Evented.extend({
const place = this.panorama.getPlace();
const timestamp = Date.parse(place.getDate());
DateLabelMixin.updateDateLabel.call(this, timestamp);
+ },
+
+ _invalidateSize: function() {
+ this.panorama.syncPort();
}
});