// 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
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
else {
$rect = selection.getRangeAt(0).getBoundingClientRect();
}
+ */
var $document = $(document);
var $offsetTop = $document.scrollTop();