# HG changeset patch # User Denis Laxalde # Date 1491499444 -7200 # Node ID 5c1abb4bd3ee20b5eb878cfef29eced92536f4a7 # Parent 7160bdd56b84aec14c7e059146f32be91d685dec hgweb: position the "followlines" box close to latest cursor position diff -r 7160bdd56b84 -r 5c1abb4bd3ee mercurial/templates/static/followlines.js --- a/mercurial/templates/static/followlines.js Thu Apr 06 19:15:09 2017 +0200 +++ b/mercurial/templates/static/followlines.js Thu Apr 06 19:24:04 2017 +0200 @@ -25,6 +25,14 @@ tooltip.textContent = initTooltipText; sourcelines.appendChild(tooltip); + //* position "element" on top-right of cursor */ + function positionTopRight(element, event) { + var x = (event.clientX + 10) + 'px', + y = (event.clientY - 20) + 'px'; + element.style.top = y; + element.style.left = x; + } + var tooltipTimeoutID; //* move the "tooltip" with cursor (top-right) and show it after 1s */ function moveAndShowTooltip(e) { @@ -33,10 +41,7 @@ window.clearTimeout(tooltipTimeoutID); } tooltip.classList.add('hidden'); - var x = (e.clientX + 10) + 'px', - y = (e.clientY - 20) + 'px'; - tooltip.style.top = y; - tooltip.style.left = x; + positionTopRight(tooltip, e); tooltipTimeoutID = window.setTimeout(function() { tooltip.classList.remove('hidden'); }, 1000); @@ -152,6 +157,8 @@ var div = divAndButton[0], button = divAndButton[1]; inviteElement.appendChild(div); + // set position close to cursor (top-right) + positionTopRight(div, e); //** event handler for cancelling selection */ function cancel() { diff -r 7160bdd56b84 -r 5c1abb4bd3ee mercurial/templates/static/style-paper.css --- a/mercurial/templates/static/style-paper.css Thu Apr 06 19:15:09 2017 +0200 +++ b/mercurial/templates/static/style-paper.css Thu Apr 06 19:24:04 2017 +0200 @@ -293,7 +293,7 @@ border: 1px solid #CCC; border-radius: 5px; padding: 4px; - position: absolute; + position: fixed; } div.followlines-cancel {