From: Alexander Ebert Date: Sun, 17 Apr 2016 07:55:37 +0000 (+0200) Subject: Avoid rounding errors when positioning elements X-Git-Tag: 3.0.0_Beta_1~1876 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d677587857418c35bfd9c092eba464eadd6640be;p=GitHub%2FWoltLab%2FWCF.git Avoid rounding errors when positioning elements --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js index 87888f78b4..8987b00797 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js @@ -152,11 +152,16 @@ define(['Core', 'Language', 'Dom/Traverse', 'Dom/Util'], function(Core, Language el.classList[(left === 'auto' ? 'add' : 'remove')](options.pointerClassNames[pointerRight]); } + if (bottom !== 'auto') bottom = Math.round(bottom) + 'px'; + if (left !== 'auto') left = Math.ceil(left) + 'px'; + if (right !== 'auto') right = Math.floor(right) + 'px'; + if (top !== 'auto') top = Math.round(top) + 'px'; + DomUtil.setStyles(el, { - bottom: bottom + (bottom !== 'auto' ? 'px' : ''), - left: left + (left !== 'auto' ? 'px' : ''), - right: right + (right !== 'auto' ? 'px' : ''), - top: top + (top !== 'auto' ? 'px' : '') + bottom: bottom, + left: left, + right: right, + top: top }); elShow(el);