| | @@ -72,10 +72,14 @@ |
| 72 | 72 | style.textContent = css; |
| 73 | 73 | document.querySelector("head").appendChild(style); |
| 74 | 74 | } |
| 75 | 75 | amendCssOnce = 0; |
| 76 | 76 | } |
| 77 | +var tooltipObj = document.createElement("span"); |
| 78 | +tooltipObj.className = "tl-tooltip"; |
| 79 | +tooltipObj.style.visibility = "hidden"; |
| 80 | +document.getElementsByTagName("BODY")[0].appendChild(tooltipObj); |
| 77 | 81 | |
| 78 | 82 | function TimelineGraph(tx){ |
| 79 | 83 | var topObj = document.getElementById("timelineTable"+tx.iTableId); |
| 80 | 84 | amendCss(tx.circleNodes, tx.showArrowheads); |
| 81 | 85 | var canvasDiv; |
| | @@ -185,20 +189,23 @@ |
| 185 | 189 | y1 = y0+elem.w; |
| 186 | 190 | cls += "h"; |
| 187 | 191 | } |
| 188 | 192 | return drawBox(cls,color,x0,y0,x1,y1); |
| 189 | 193 | } |
| 190 | | - function drawUpArrow(from,to,color){ |
| 194 | + function drawUpArrow(from,to,color,id){ |
| 191 | 195 | var y = to.y + node.h; |
| 192 | 196 | var arrowSpace = from.y - y + (!from.id || from.r!=to.r ? node.h/2 : 0); |
| 193 | 197 | var arw = arrowSpace < arrow.h*1.5 ? arrowSmall : arrow; |
| 194 | 198 | var x = to.x + (node.w-line.w)/2; |
| 195 | 199 | var y0 = from.y + node.h/2; |
| 196 | 200 | var y1 = Math.ceil(to.y + node.h + arw.h/2); |
| 197 | | - drawLine(line,color,x,y0,null,y1); |
| 201 | + var n = drawLine(line,color,x,y0,null,y1); |
| 202 | + n.onmouseenter = tooltipEnter |
| 203 | + n.onmouseleave = tooltipLeave |
| 204 | + n.setAttribute("data-id",id) |
| 198 | 205 | x = to.x + (node.w-arw.w)/2; |
| 199 | | - var n = drawBox(arw.cls,null,x,y); |
| 206 | + n = drawBox(arw.cls,null,x,y); |
| 200 | 207 | if(color) n.style.borderBottomColor = color; |
| 201 | 208 | } |
| 202 | 209 | function drawDotted(from,to,color){ |
| 203 | 210 | var x = to.x + (node.w-line.w)/2; |
| 204 | 211 | var y0 = from.y + node.h/2; |
| | @@ -243,12 +250,12 @@ |
| 243 | 250 | if(e) e.style.backgroundColor = p.bg; |
| 244 | 251 | e = document.getElementById("md"+p.id); |
| 245 | 252 | if(e) e.style.backgroundColor = p.bg; |
| 246 | 253 | } |
| 247 | 254 | if( p.r<0 ) return; |
| 248 | | - if( p.u>0 ) drawUpArrow(p,tx.rowinfo[p.u-tx.iTopRow],p.fg); |
| 249 | | - if( p.sb>0 ) drawDotted(p,tx.rowinfo[p.sb-tx.iTopRow],p.fg); |
| 255 | + if( p.u>0 ) drawUpArrow(p,tx.rowinfo[p.u-tx.iTopRow],p.fg,p.id); |
| 256 | + if( p.sb>0 ) drawDotted(p,tx.rowinfo[p.sb-tx.iTopRow],p.fg,p.id); |
| 250 | 257 | var cls = node.cls; |
| 251 | 258 | if( p.hasOwnProperty('mi') && p.mi.length ) cls += " merge"; |
| 252 | 259 | if( p.f&1 ) cls += " leaf"; |
| 253 | 260 | var n = drawBox(cls,p.bg,p.x,p.y); |
| 254 | 261 | n.id = "tln"+p.id; |
| | @@ -257,22 +264,22 @@ |
| 257 | 264 | if( !tx.omitDescenders ){ |
| 258 | 265 | if( p.u==0 ){ |
| 259 | 266 | if( p.hasOwnProperty('mo') && p.r==p.mo ){ |
| 260 | 267 | var ix = p.hasOwnProperty('cu') ? p.cu : p.mu; |
| 261 | 268 | var top = tx.rowinfo[ix-tx.iTopRow] |
| 262 | | - drawUpArrow(p,{x: p.x, y: top.y-node.h}, p.fg); |
| 269 | + drawUpArrow(p,{x: p.x, y: top.y-node.h}, p.fg, p.id); |
| 263 | 270 | }else if( p.y>100 ){ |
| 264 | | - drawUpArrow(p,{x: p.x, y: p.y-50}, p.fg); |
| 271 | + drawUpArrow(p,{x: p.x, y: p.y-50}, p.fg, p.id); |
| 265 | 272 | }else{ |
| 266 | | - drawUpArrow(p,{x: p.x, y: 0},p.fg); |
| 273 | + drawUpArrow(p,{x: p.x, y: 0},p.fg, p.id); |
| 267 | 274 | } |
| 268 | 275 | } |
| 269 | 276 | if( p.hasOwnProperty('d') ){ |
| 270 | 277 | if( p.y + 150 >= btm ){ |
| 271 | | - drawUpArrow({x: p.x, y: btm - node.h/2},p,p.fg); |
| 278 | + drawUpArrow({x: p.x, y: btm - node.h/2},p,p.fg,p.id); |
| 272 | 279 | }else{ |
| 273 | | - drawUpArrow({x: p.x, y: p.y+50},p,p.fg); |
| 280 | + drawUpArrow({x: p.x, y: p.y+50},p,p.fg,p.id); |
| 274 | 281 | drawDotted({x: p.x, y: p.y+63},{x: p.x, y: p.y+50-node.h/2},p.fg); |
| 275 | 282 | } |
| 276 | 283 | } |
| 277 | 284 | } |
| 278 | 285 | if( p.hasOwnProperty('mo') ){ |
| | @@ -326,11 +333,11 @@ |
| 326 | 333 | } |
| 327 | 334 | var y0 = p.y + (node.h-line.w)/2; |
| 328 | 335 | var u = tx.rowinfo[p.au[i+1]-tx.iTopRow]; |
| 329 | 336 | if( u.id<p.id ){ |
| 330 | 337 | drawLine(line,u.fg,x0,y0,x1,null); |
| 331 | | - drawUpArrow(p,u,u.fg); |
| 338 | + drawUpArrow(p,u,u.fg,u.id); |
| 332 | 339 | }else{ |
| 333 | 340 | var y1 = u.y + (node.h-line.w)/2; |
| 334 | 341 | drawLine(wLine,u.fg,x0,y0,x1,null); |
| 335 | 342 | drawLine(wLine,u.fg,x1-line.w,y0,null,y1+line.w); |
| 336 | 343 | drawLine(wLine,u.fg,x1,y1,u.x-wArrow.w/2,null); |
| | @@ -408,10 +415,24 @@ |
| 408 | 415 | }else{ |
| 409 | 416 | location.href=tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h |
| 410 | 417 | } |
| 411 | 418 | } |
| 412 | 419 | } |
| 420 | + function tooltipEnter(e){ |
| 421 | + var id = this.getAttribute("data-id") |
| 422 | + tooltipObj.textContent = tx.rowinfo[id-tx.iTopRow].br |
| 423 | + tooltipObj.style.display = "inline" |
| 424 | + tooltipObj.style.position = "absolute" |
| 425 | + var x = e.x + 4 + window.pageXOffset |
| 426 | + tooltipObj.style.left = x+"px" |
| 427 | + var y = e.y + window.pageYOffset - tooltipObj.clientHeight - 4 |
| 428 | + tooltipObj.style.top = y+"px" |
| 429 | + tooltipObj.style.visibility = "visible" |
| 430 | + } |
| 431 | + function tooltipLeave(e){ |
| 432 | + tooltipObj.style.display = "none" |
| 433 | + } |
| 413 | 434 | function changeDisplay(selector,value){ |
| 414 | 435 | var x = document.getElementsByClassName(selector); |
| 415 | 436 | var n = x.length; |
| 416 | 437 | for(var i=0; i<n; i++) {x[i].style.display = value;} |
| 417 | 438 | } |
| 418 | 439 | |