From: Alexander Ebert Date: Wed, 18 May 2022 16:21:59 +0000 (+0200) Subject: Image viewer broke during orientation change X-Git-Tag: 5.5.0_Beta_3~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a87103a0e66bc789a9d6765928427dd4c9de0cbb;p=GitHub%2FWoltLab%2FWCF.git Image viewer broke during orientation change See https://www.woltlab.com/community/thread/295628-mobil-bildanzeige-skaliert-beim-drehen/ --- diff --git a/wcfsetup/install/files/js/WCF.ImageViewer.js b/wcfsetup/install/files/js/WCF.ImageViewer.js index 54ca2cbf12..0fcd4ab604 100644 --- a/wcfsetup/install/files/js/WCF.ImageViewer.js +++ b/wcfsetup/install/files/js/WCF.ImageViewer.js @@ -511,7 +511,12 @@ $.widget('ui.wcfImageViewer', { */ _bindListener: function() { $(document).on('keydown.' + this._eventNamespace, $.proxy(this._keyDown, this)); - $(window).on('resize.' + this._eventNamespace, $.proxy(this._renderImage, this)); + $(window).on('resize.' + this._eventNamespace, () => { + // The resize event can trigger before the mobile UI has + // adapted to the new screen size (`screen-sm-down` no + // longer matches or previously did not match). + window.setTimeout(() => this._renderImage(), 0); + }); }, /**