From c1b31f6f16d665b5c42cc0e9f130c3a99d3dc184 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 10 Feb 2013 21:28:42 +0100 Subject: [PATCH] Improved visuals for dialog overlays --- wcfsetup/install/files/js/WCF.js | 21 ++++++++++++++++++++- wcfsetup/install/files/style/dialog.less | 1 - 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 2fa5f64f23..59537da552 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -7701,10 +7701,11 @@ $.widget('ui.wcfDialog', { // remove static dimensions this._content.css({ height: 'auto', - overflow: 'auto', width: 'auto' }); + this._determineOverflow(); + if (!this.isOpen()) { // hide container again this._container.hide(); @@ -7718,6 +7719,24 @@ $.widget('ui.wcfDialog', { } }, + /** + * Determines content overflow based upon static dimensions. + */ + _determineOverflow: function() { + var $max = $(window).getDimensions(); + var $maxHeight = this._content.css('maxHeight'); + this._content.css('maxHeight', 'none'); + var $dialog = this._container.getDimensions('outer'); + + var $overflow = 'visible'; + if (($max.height * 0.8 < $dialog.height) || ($max.width * 0.8 < $dialog.width)) { + $overflow = 'auto'; + } + + this._content.css('overflow', $overflow); + this._content.css('maxHeight', $maxHeight); + }, + /** * Returns calculated content dimensions. * diff --git a/wcfsetup/install/files/style/dialog.less b/wcfsetup/install/files/style/dialog.less index 7e322612b7..ab3413dda7 100644 --- a/wcfsetup/install/files/style/dialog.less +++ b/wcfsetup/install/files/style/dialog.less @@ -59,7 +59,6 @@ .dialogContent { background-color: @wcfContainerBackgroundColor; color: @wcfColor; - overflow: auto; padding: 10px 20px 20px; &:not(.dialogForm) { -- 2.20.1