Fossil SCM
Add tooltips to more elements. Click to jump to the branch displayed by the tooltip - except clicking no a node toggles the node selection on and off as it always has.
Commit
804dbe0d5b35d1647d42c436befebbcc2049da6e7b03eee4ba1c522fb4830fd1
Parent
8e922935feb9445…
1 file changed
+24
-8
+24
-8
| --- src/graph.js | ||
| +++ src/graph.js | ||
| @@ -75,11 +75,11 @@ | ||
| 75 | 75 | amendCssOnce = 0; |
| 76 | 76 | } |
| 77 | 77 | var tooltipObj = document.createElement("span"); |
| 78 | 78 | tooltipObj.className = "tl-tooltip"; |
| 79 | 79 | tooltipObj.style.visibility = "hidden"; |
| 80 | -document.getElementsByTagName("BODY")[0].appendChild(tooltipObj); | |
| 80 | +document.getElementsByClassName("content")[0].appendChild(tooltipObj); | |
| 81 | 81 | |
| 82 | 82 | function TimelineGraph(tx){ |
| 83 | 83 | var topObj = document.getElementById("timelineTable"+tx.iTableId); |
| 84 | 84 | amendCss(tx.circleNodes, tx.showArrowheads); |
| 85 | 85 | var canvasDiv; |
| @@ -197,23 +197,31 @@ | ||
| 197 | 197 | var arw = arrowSpace < arrow.h*1.5 ? arrowSmall : arrow; |
| 198 | 198 | var x = to.x + (node.w-line.w)/2; |
| 199 | 199 | var y0 = from.y + node.h/2; |
| 200 | 200 | var y1 = Math.ceil(to.y + node.h + arw.h/2); |
| 201 | 201 | var n = drawLine(line,color,x,y0,null,y1); |
| 202 | - n.onmouseenter = tooltipEnter | |
| 203 | - n.onmouseleave = tooltipLeave | |
| 204 | - n.setAttribute("data-id",id) | |
| 202 | + addToolTip(n,id) | |
| 205 | 203 | x = to.x + (node.w-arw.w)/2; |
| 206 | 204 | n = drawBox(arw.cls,null,x,y); |
| 207 | 205 | if(color) n.style.borderBottomColor = color; |
| 206 | + addToolTip(n,id) | |
| 208 | 207 | } |
| 209 | - function drawDotted(from,to,color){ | |
| 208 | + function drawDotted(from,to,color,id){ | |
| 210 | 209 | var x = to.x + (node.w-line.w)/2; |
| 211 | 210 | var y0 = from.y + node.h/2; |
| 212 | 211 | var y1 = Math.ceil(to.y + node.h); |
| 213 | 212 | var n = drawLine(dotLine,null,x,y0,null,y1) |
| 214 | 213 | if( color ) n.style.borderColor = color |
| 214 | + addToolTip(n,id) | |
| 215 | + } | |
| 216 | + function addToolTip(n,id){ | |
| 217 | + if( id ){ | |
| 218 | + n.onmouseenter = tooltipEnter | |
| 219 | + n.onmouseleave = tooltipLeave | |
| 220 | + n.onclick = tooltipClick | |
| 221 | + n.setAttribute("data-ix",id-tx.iTopRow) | |
| 222 | + } | |
| 215 | 223 | } |
| 216 | 224 | /* Draw thin horizontal or vertical lines representing merges */ |
| 217 | 225 | function drawMergeLine(x0,y0,x1,y1){ |
| 218 | 226 | drawLine(mLine,null,x0,y0,x1,y1); |
| 219 | 227 | } |
| @@ -257,10 +265,11 @@ | ||
| 257 | 265 | var cls = node.cls; |
| 258 | 266 | if( p.hasOwnProperty('mi') && p.mi.length ) cls += " merge"; |
| 259 | 267 | if( p.f&1 ) cls += " leaf"; |
| 260 | 268 | var n = drawBox(cls,p.bg,p.x,p.y); |
| 261 | 269 | n.id = "tln"+p.id; |
| 270 | + addToolTip(n,p.id) | |
| 262 | 271 | n.onclick = clickOnNode; |
| 263 | 272 | n.style.zIndex = 10; |
| 264 | 273 | if( !tx.omitDescenders ){ |
| 265 | 274 | if( p.u==0 ){ |
| 266 | 275 | if( p.hasOwnProperty('mo') && p.r==p.mo ){ |
| @@ -276,11 +285,11 @@ | ||
| 276 | 285 | if( p.hasOwnProperty('d') ){ |
| 277 | 286 | if( p.y + 150 >= btm ){ |
| 278 | 287 | drawUpArrow({x: p.x, y: btm - node.h/2},p,p.fg,p.id); |
| 279 | 288 | }else{ |
| 280 | 289 | drawUpArrow({x: p.x, y: p.y+50},p,p.fg,p.id); |
| 281 | - drawDotted({x: p.x, y: p.y+63},{x: p.x, y: p.y+50-node.h/2},p.fg); | |
| 290 | + drawDotted({x: p.x, y: p.y+63},{x: p.x, y: p.y+50-node.h/2},p.fg,p.id); | |
| 282 | 291 | } |
| 283 | 292 | } |
| 284 | 293 | } |
| 285 | 294 | if( p.hasOwnProperty('mo') ){ |
| 286 | 295 | var x0 = p.x + node.w/2; |
| @@ -416,20 +425,27 @@ | ||
| 416 | 425 | location.href=tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h |
| 417 | 426 | } |
| 418 | 427 | } |
| 419 | 428 | } |
| 420 | 429 | function tooltipEnter(e){ |
| 421 | - var id = this.getAttribute("data-id") | |
| 422 | - tooltipObj.textContent = tx.rowinfo[id-tx.iTopRow].br | |
| 430 | + var ix = this.getAttribute("data-ix") | |
| 431 | + tooltipObj.textContent = tx.rowinfo[ix].br | |
| 423 | 432 | tooltipObj.style.display = "inline" |
| 424 | 433 | tooltipObj.style.position = "absolute" |
| 425 | 434 | var x = e.x + 4 + window.pageXOffset |
| 426 | 435 | tooltipObj.style.left = x+"px" |
| 427 | 436 | var y = e.y + window.pageYOffset - tooltipObj.clientHeight - 4 |
| 428 | 437 | tooltipObj.style.top = y+"px" |
| 429 | 438 | tooltipObj.style.visibility = "visible" |
| 430 | 439 | } |
| 440 | + function tooltipClick(e){ | |
| 441 | + var ix = this.getAttribute("data-ix") | |
| 442 | + var br = tx.rowinfo[ix].br | |
| 443 | + var dest = "/timeline?r=" + encodeURIComponent(br) | |
| 444 | + tooltipObj.style.display = "none" | |
| 445 | + window.location.href = tx.baseUrl + dest | |
| 446 | + } | |
| 431 | 447 | function tooltipLeave(e){ |
| 432 | 448 | tooltipObj.style.display = "none" |
| 433 | 449 | } |
| 434 | 450 | function changeDisplay(selector,value){ |
| 435 | 451 | var x = document.getElementsByClassName(selector); |
| 436 | 452 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -75,11 +75,11 @@ | |
| 75 | amendCssOnce = 0; |
| 76 | } |
| 77 | var tooltipObj = document.createElement("span"); |
| 78 | tooltipObj.className = "tl-tooltip"; |
| 79 | tooltipObj.style.visibility = "hidden"; |
| 80 | document.getElementsByTagName("BODY")[0].appendChild(tooltipObj); |
| 81 | |
| 82 | function TimelineGraph(tx){ |
| 83 | var topObj = document.getElementById("timelineTable"+tx.iTableId); |
| 84 | amendCss(tx.circleNodes, tx.showArrowheads); |
| 85 | var canvasDiv; |
| @@ -197,23 +197,31 @@ | |
| 197 | var arw = arrowSpace < arrow.h*1.5 ? arrowSmall : arrow; |
| 198 | var x = to.x + (node.w-line.w)/2; |
| 199 | var y0 = from.y + node.h/2; |
| 200 | var y1 = Math.ceil(to.y + node.h + arw.h/2); |
| 201 | var n = drawLine(line,color,x,y0,null,y1); |
| 202 | n.onmouseenter = tooltipEnter |
| 203 | n.onmouseleave = tooltipLeave |
| 204 | n.setAttribute("data-id",id) |
| 205 | x = to.x + (node.w-arw.w)/2; |
| 206 | n = drawBox(arw.cls,null,x,y); |
| 207 | if(color) n.style.borderBottomColor = color; |
| 208 | } |
| 209 | function drawDotted(from,to,color){ |
| 210 | var x = to.x + (node.w-line.w)/2; |
| 211 | var y0 = from.y + node.h/2; |
| 212 | var y1 = Math.ceil(to.y + node.h); |
| 213 | var n = drawLine(dotLine,null,x,y0,null,y1) |
| 214 | if( color ) n.style.borderColor = color |
| 215 | } |
| 216 | /* Draw thin horizontal or vertical lines representing merges */ |
| 217 | function drawMergeLine(x0,y0,x1,y1){ |
| 218 | drawLine(mLine,null,x0,y0,x1,y1); |
| 219 | } |
| @@ -257,10 +265,11 @@ | |
| 257 | var cls = node.cls; |
| 258 | if( p.hasOwnProperty('mi') && p.mi.length ) cls += " merge"; |
| 259 | if( p.f&1 ) cls += " leaf"; |
| 260 | var n = drawBox(cls,p.bg,p.x,p.y); |
| 261 | n.id = "tln"+p.id; |
| 262 | n.onclick = clickOnNode; |
| 263 | n.style.zIndex = 10; |
| 264 | if( !tx.omitDescenders ){ |
| 265 | if( p.u==0 ){ |
| 266 | if( p.hasOwnProperty('mo') && p.r==p.mo ){ |
| @@ -276,11 +285,11 @@ | |
| 276 | if( p.hasOwnProperty('d') ){ |
| 277 | if( p.y + 150 >= btm ){ |
| 278 | drawUpArrow({x: p.x, y: btm - node.h/2},p,p.fg,p.id); |
| 279 | }else{ |
| 280 | drawUpArrow({x: p.x, y: p.y+50},p,p.fg,p.id); |
| 281 | drawDotted({x: p.x, y: p.y+63},{x: p.x, y: p.y+50-node.h/2},p.fg); |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | if( p.hasOwnProperty('mo') ){ |
| 286 | var x0 = p.x + node.w/2; |
| @@ -416,20 +425,27 @@ | |
| 416 | location.href=tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h |
| 417 | } |
| 418 | } |
| 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 | } |
| 434 | function changeDisplay(selector,value){ |
| 435 | var x = document.getElementsByClassName(selector); |
| 436 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -75,11 +75,11 @@ | |
| 75 | amendCssOnce = 0; |
| 76 | } |
| 77 | var tooltipObj = document.createElement("span"); |
| 78 | tooltipObj.className = "tl-tooltip"; |
| 79 | tooltipObj.style.visibility = "hidden"; |
| 80 | document.getElementsByClassName("content")[0].appendChild(tooltipObj); |
| 81 | |
| 82 | function TimelineGraph(tx){ |
| 83 | var topObj = document.getElementById("timelineTable"+tx.iTableId); |
| 84 | amendCss(tx.circleNodes, tx.showArrowheads); |
| 85 | var canvasDiv; |
| @@ -197,23 +197,31 @@ | |
| 197 | var arw = arrowSpace < arrow.h*1.5 ? arrowSmall : arrow; |
| 198 | var x = to.x + (node.w-line.w)/2; |
| 199 | var y0 = from.y + node.h/2; |
| 200 | var y1 = Math.ceil(to.y + node.h + arw.h/2); |
| 201 | var n = drawLine(line,color,x,y0,null,y1); |
| 202 | addToolTip(n,id) |
| 203 | x = to.x + (node.w-arw.w)/2; |
| 204 | n = drawBox(arw.cls,null,x,y); |
| 205 | if(color) n.style.borderBottomColor = color; |
| 206 | addToolTip(n,id) |
| 207 | } |
| 208 | function drawDotted(from,to,color,id){ |
| 209 | var x = to.x + (node.w-line.w)/2; |
| 210 | var y0 = from.y + node.h/2; |
| 211 | var y1 = Math.ceil(to.y + node.h); |
| 212 | var n = drawLine(dotLine,null,x,y0,null,y1) |
| 213 | if( color ) n.style.borderColor = color |
| 214 | addToolTip(n,id) |
| 215 | } |
| 216 | function addToolTip(n,id){ |
| 217 | if( id ){ |
| 218 | n.onmouseenter = tooltipEnter |
| 219 | n.onmouseleave = tooltipLeave |
| 220 | n.onclick = tooltipClick |
| 221 | n.setAttribute("data-ix",id-tx.iTopRow) |
| 222 | } |
| 223 | } |
| 224 | /* Draw thin horizontal or vertical lines representing merges */ |
| 225 | function drawMergeLine(x0,y0,x1,y1){ |
| 226 | drawLine(mLine,null,x0,y0,x1,y1); |
| 227 | } |
| @@ -257,10 +265,11 @@ | |
| 265 | var cls = node.cls; |
| 266 | if( p.hasOwnProperty('mi') && p.mi.length ) cls += " merge"; |
| 267 | if( p.f&1 ) cls += " leaf"; |
| 268 | var n = drawBox(cls,p.bg,p.x,p.y); |
| 269 | n.id = "tln"+p.id; |
| 270 | addToolTip(n,p.id) |
| 271 | n.onclick = clickOnNode; |
| 272 | n.style.zIndex = 10; |
| 273 | if( !tx.omitDescenders ){ |
| 274 | if( p.u==0 ){ |
| 275 | if( p.hasOwnProperty('mo') && p.r==p.mo ){ |
| @@ -276,11 +285,11 @@ | |
| 285 | if( p.hasOwnProperty('d') ){ |
| 286 | if( p.y + 150 >= btm ){ |
| 287 | drawUpArrow({x: p.x, y: btm - node.h/2},p,p.fg,p.id); |
| 288 | }else{ |
| 289 | drawUpArrow({x: p.x, y: p.y+50},p,p.fg,p.id); |
| 290 | drawDotted({x: p.x, y: p.y+63},{x: p.x, y: p.y+50-node.h/2},p.fg,p.id); |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | if( p.hasOwnProperty('mo') ){ |
| 295 | var x0 = p.x + node.w/2; |
| @@ -416,20 +425,27 @@ | |
| 425 | location.href=tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | function tooltipEnter(e){ |
| 430 | var ix = this.getAttribute("data-ix") |
| 431 | tooltipObj.textContent = tx.rowinfo[ix].br |
| 432 | tooltipObj.style.display = "inline" |
| 433 | tooltipObj.style.position = "absolute" |
| 434 | var x = e.x + 4 + window.pageXOffset |
| 435 | tooltipObj.style.left = x+"px" |
| 436 | var y = e.y + window.pageYOffset - tooltipObj.clientHeight - 4 |
| 437 | tooltipObj.style.top = y+"px" |
| 438 | tooltipObj.style.visibility = "visible" |
| 439 | } |
| 440 | function tooltipClick(e){ |
| 441 | var ix = this.getAttribute("data-ix") |
| 442 | var br = tx.rowinfo[ix].br |
| 443 | var dest = "/timeline?r=" + encodeURIComponent(br) |
| 444 | tooltipObj.style.display = "none" |
| 445 | window.location.href = tx.baseUrl + dest |
| 446 | } |
| 447 | function tooltipLeave(e){ |
| 448 | tooltipObj.style.display = "none" |
| 449 | } |
| 450 | function changeDisplay(selector,value){ |
| 451 | var x = document.getElementsByClassName(selector); |
| 452 |