From: Alexander Ebert Date: Sat, 28 Sep 2013 11:52:23 +0000 (+0200) Subject: getBoundingClientRect() seem to provide better dimensions X-Git-Tag: 2.0.0_Beta_10~13^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2011f1b56278fea6a6cdcd8fba439cea56f4c404;p=GitHub%2FWoltLab%2FWCF.git getBoundingClientRect() seem to provide better dimensions --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 9320f66606..dca2528a84 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -1879,6 +1879,9 @@ WCF.Message.Quote.Handler = Class.extend({ // the coordinates returned by getBoundingClientRect() is relative to the window, not the document! //var $rect = selection.getRangeAt(0).getBoundingClientRect(); var $rects = selection.getRangeAt(0).getClientRects(); + var $rect = selection.getRangeAt(0).getBoundingClientRect(); + + /* var $rect = { }; if (!$.browser.mozilla && $rects.length > 1) { // save current selection to restore it later @@ -1890,9 +1893,9 @@ WCF.Message.Quote.Handler = Class.extend({ var $position2 = this._getOffset($range, false); $rect = { - left: ($position1.left > $position2.left) ? $position2.left : $position1.left, - right: ($position1.left > $position2.left) ? $position1.left : $position2.left, - top: ($position1.top > $position2.top) ? $position2.top : $position1.top + left: Math.min($position1.left, $position2.left), + right: Math.max($position1.left, $position2.left), + top: Math.max($position1.top, $position2.top) }; // restore selection @@ -1901,6 +1904,7 @@ WCF.Message.Quote.Handler = Class.extend({ else { $rect = selection.getRangeAt(0).getBoundingClientRect(); } + */ var $document = $(document); var $offsetTop = $document.scrollTop();