#2: further fix first transition, fix wrong position on scrolled document

master
Harald Wolff 2019-10-17 11:45:01 +02:00
parent 9bb9a877af
commit 0de72abc3d
1 changed files with 9 additions and 5 deletions

View File

@ -7,6 +7,7 @@ var tootlipVisible = false;
var tooltipEl = LNVue.$(`<div class="ln-tooltip"></div>`);
function findTooltipData(el){
let tooltip = null;
while (!tooltip)
@ -18,9 +19,6 @@ function findTooltipData(el){
}
function tooltipShow(ev,tooltip){
if (!document.body.contains(tooltipEl))
document.body.appendChild(tooltipEl);
tooltipEl.innerText = tooltip.value;
tooltipEl.setAttribute("VISIBLE","");
@ -32,13 +30,19 @@ function tooltipHide(ev,tooltip){
}
function tooltipMouseOver(ev){
if (!document.body.contains(tooltipEl)){
document.body.appendChild(tooltipEl);
LNVue.onidle(()=>{ tooltipMouseOver(ev);});
return;
}
let tooltip = findTooltipData(ev.target);
if (!tooltip)
console.log(ev);
if (tooltipEl){
tooltipEl.style.left = `${ev.x+3}px`;
tooltipEl.style.top = `${ev.y+3}px`;
tooltipEl.style.left = `${ev.pageX+3}px`;
tooltipEl.style.top = `${ev.pageY+3}px`;
}
if (tooltip.timeout)