From d677587857418c35bfd9c092eba464eadd6640be Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 17 Apr 2016 09:55:37 +0200 Subject: [PATCH] Avoid rounding errors when positioning elements --- .../install/files/js/WoltLab/WCF/Ui/Alignment.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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); -- 2.20.1