Mercurial > hg
changeset 31849:5c1abb4bd3ee
hgweb: position the "followlines" box close to latest cursor position
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Thu, 06 Apr 2017 19:24:04 +0200 |
parents | 7160bdd56b84 |
children | f0d719e513fc |
files | mercurial/templates/static/followlines.js mercurial/templates/static/style-paper.css |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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() {
--- 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 {