Use a resize observer to center the popup after an image is loaded when polyfilled

b05d5e12fe2940b189812f6ceddea95d91c7ccec

QuantumEntangledAndy <sheepchaan@gmail.com>

Signed
1 files changed, +8 -0Ignore whitespace
public/scripts/popup.js+8 -0
@@ -182,6 +182,14 @@ export class Popup {
182 if (!this.dlg.showModal) {182 if (!this.dlg.showModal) {
183 this.dlg.classList.add('poly_dialog');183 this.dlg.classList.add('poly_dialog');
184 dialogPolyfill.registerDialog(this.dlg);184 dialogPolyfill.registerDialog(this.dlg);
185 // Force a vertical reposition after the content
186 // (like crop image) has been set
187 const resizeObserver = new ResizeObserver((entries) => {
188 for (const entry of entries) {
189 dialogPolyfill.reposition(entry.target);
190 }
191 });
192 resizeObserver.observe(this.dlg);
185 }193 }
186 this.body = this.dlg.querySelector('.popup-body');194 this.body = this.dlg.querySelector('.popup-body');
187 this.content = this.dlg.querySelector('.popup-content');195 this.content = this.dlg.querySelector('.popup-content');