##// END OF EJS Templates
hgweb: position the "followlines" box close to latest cursor position
Denis Laxalde -
r31849:5c1abb4b default
parent child Browse files
Show More
@@ -25,6 +25,14 b" document.addEventListener('DOMContentLoa"
25 tooltip.textContent = initTooltipText;
25 tooltip.textContent = initTooltipText;
26 sourcelines.appendChild(tooltip);
26 sourcelines.appendChild(tooltip);
27
27
28 //* position "element" on top-right of cursor */
29 function positionTopRight(element, event) {
30 var x = (event.clientX + 10) + 'px',
31 y = (event.clientY - 20) + 'px';
32 element.style.top = y;
33 element.style.left = x;
34 }
35
28 var tooltipTimeoutID;
36 var tooltipTimeoutID;
29 //* move the "tooltip" with cursor (top-right) and show it after 1s */
37 //* move the "tooltip" with cursor (top-right) and show it after 1s */
30 function moveAndShowTooltip(e) {
38 function moveAndShowTooltip(e) {
@@ -33,10 +41,7 b" document.addEventListener('DOMContentLoa"
33 window.clearTimeout(tooltipTimeoutID);
41 window.clearTimeout(tooltipTimeoutID);
34 }
42 }
35 tooltip.classList.add('hidden');
43 tooltip.classList.add('hidden');
36 var x = (e.clientX + 10) + 'px',
44 positionTopRight(tooltip, e);
37 y = (e.clientY - 20) + 'px';
38 tooltip.style.top = y;
39 tooltip.style.left = x;
40 tooltipTimeoutID = window.setTimeout(function() {
45 tooltipTimeoutID = window.setTimeout(function() {
41 tooltip.classList.remove('hidden');
46 tooltip.classList.remove('hidden');
42 }, 1000);
47 }, 1000);
@@ -152,6 +157,8 b" document.addEventListener('DOMContentLoa"
152 var div = divAndButton[0],
157 var div = divAndButton[0],
153 button = divAndButton[1];
158 button = divAndButton[1];
154 inviteElement.appendChild(div);
159 inviteElement.appendChild(div);
160 // set position close to cursor (top-right)
161 positionTopRight(div, e);
155
162
156 //** event handler for cancelling selection */
163 //** event handler for cancelling selection */
157 function cancel() {
164 function cancel() {
@@ -293,7 +293,7 b' div#followlines {'
293 border: 1px solid #CCC;
293 border: 1px solid #CCC;
294 border-radius: 5px;
294 border-radius: 5px;
295 padding: 4px;
295 padding: 4px;
296 position: absolute;
296 position: fixed;
297 }
297 }
298
298
299 div.followlines-cancel {
299 div.followlines-cancel {
General Comments 0
You need to be logged in to leave comments. Login now