Fossil SCM
Make it easier to hit the graph nodes for click-to-diff when running on phones and tablets.
Commit
781e5bed896b2b9e0214ba2583074b0ef7f0eddf
Parent
c23e6444f55f60b…
1 file changed
+9
-32
+9
-32
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -211,19 +211,20 @@ | ||
| 211 | 211 | if( tmFlags & TIMELINE_GRAPH ){ |
| 212 | 212 | pGraph = graph_init(); |
| 213 | 213 | /* style is not moved to css, because this is |
| 214 | 214 | ** a technical div for the timeline graph |
| 215 | 215 | */ |
| 216 | - @ <div id="canvas" style="position:relative;width:1px;height:1px;" | |
| 216 | + @ <div id="canvas" style="position:relative;height:0px;width:0px;" | |
| 217 | 217 | @ onclick="clickOnGraph(event)"></div> |
| 218 | 218 | } |
| 219 | 219 | db_static_prepare(&qbranch, |
| 220 | 220 | "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", |
| 221 | 221 | TAG_BRANCH |
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | - @ <table id="timelineTable" class="timelineTable"> | |
| 224 | + @ <table id="timelineTable" class="timelineTable" | |
| 225 | + @ onclick="clickOnGraph(event)"> | |
| 225 | 226 | blob_zero(&comment); |
| 226 | 227 | while( db_step(pQuery)==SQLITE_ROW ){ |
| 227 | 228 | int rid = db_column_int(pQuery, 0); |
| 228 | 229 | const char *zUuid = db_column_text(pQuery, 1); |
| 229 | 230 | int isLeaf = db_column_int(pQuery, 5); |
| @@ -727,42 +728,16 @@ | ||
| 727 | 728 | @ for(var i in rowinfo){ |
| 728 | 729 | @ rowinfo[i].y = absoluteY("m"+rowinfo[i].id) + 10 - canvasY; |
| 729 | 730 | @ rowinfo[i].x = left + rowinfo[i].r*railPitch; |
| 730 | 731 | @ } |
| 731 | 732 | @ var btm = absoluteY("grbtm") + 10 - canvasY; |
| 732 | -#if 0 | |
| 733 | - @ if( btm<32768 ){ | |
| 734 | - @ canvasDiv.innerHTML = '<canvas id="timeline-canvas" '+ | |
| 735 | - @ 'style="position:absolute;left:'+(left-5)+'px;"' + | |
| 736 | - @ ' width="'+width+'" height="'+btm+'"><'+'/canvas>'; | |
| 737 | - @ realCanvas = gebi('timeline-canvas'); | |
| 738 | - @ }else{ | |
| 739 | - @ realCanvas = 0; | |
| 740 | - @ } | |
| 741 | - @ var context; | |
| 742 | - @ if( realCanvas && realCanvas.getContext | |
| 743 | - @ && (context = realCanvas.getContext('2d'))) { | |
| 744 | - @ drawBox = function(color,x0,y0,x1,y1) { | |
| 745 | - @ if( y0>32767 || y1>32767 ) return; | |
| 746 | - @ if( x0>x1 ){ var t=x0; x0=x1; x1=t; } | |
| 747 | - @ if( y0>y1 ){ var t=y0; y0=y1; y1=t; } | |
| 748 | - @ if(isNaN(x0) || isNaN(y0) || isNaN(x1) || isNaN(y1)) return; | |
| 749 | - @ context.fillStyle = color; | |
| 750 | - @ context.fillRect(x0-left+5,y0,x1-x0+1,y1-y0+1); | |
| 751 | - @ }; | |
| 752 | - @ } | |
| 753 | -#endif | |
| 754 | 733 | @ for(var i in rowinfo){ |
| 755 | 734 | @ drawNode(rowinfo[i], left, btm); |
| 756 | 735 | @ } |
| 757 | 736 | @ if( selRow!=null ) clickOnRow(selRow); |
| 758 | 737 | @ } |
| 759 | 738 | @ function clickOnGraph(event){ |
| 760 | -#ifdef OMIT_IE8_SUPPORT | |
| 761 | - @ var x=event.clientX-absoluteX("canvas")+window.pageXOffset; | |
| 762 | - @ var y=event.clientY-absoluteY("canvas")+window.pageYOffset; | |
| 763 | -#else | |
| 764 | 739 | @ var x=event.clientX-absoluteX("canvas"); |
| 765 | 740 | @ var y=event.clientY-absoluteY("canvas"); |
| 766 | 741 | @ if(window.pageXOffset!=null){ |
| 767 | 742 | @ x += window.pageXOffset; |
| 768 | 743 | @ y += window.pageYOffset; |
| @@ -770,16 +745,18 @@ | ||
| 770 | 745 | @ var d = window.document.documentElement; |
| 771 | 746 | @ if(document.compatMode!="CSS1Compat") d = d.body; |
| 772 | 747 | @ x += d.scrollLeft; |
| 773 | 748 | @ y += d.scrollTop; |
| 774 | 749 | @ } |
| 775 | -#endif | |
| 750 | + if( P("clicktest")!=0 ){ | |
| 751 | + @ alert("click at "+x+","+y) | |
| 752 | + } | |
| 776 | 753 | @ for(var i in rowinfo){ |
| 777 | 754 | @ p = rowinfo[i]; |
| 778 | - @ if( p.y<y-10 ) continue; | |
| 779 | - @ if( p.y>y+10 ) break; | |
| 780 | - @ if( p.x>x-10 && p.x<x+10 ){ | |
| 755 | + @ if( p.y<y-11 ) continue; | |
| 756 | + @ if( p.y>y+9 ) break; | |
| 757 | + @ if( p.x>x-11 && p.x<x+9 ){ | |
| 781 | 758 | @ clickOnRow(p); |
| 782 | 759 | @ break; |
| 783 | 760 | @ } |
| 784 | 761 | @ } |
| 785 | 762 | @ } |
| 786 | 763 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -211,19 +211,20 @@ | |
| 211 | if( tmFlags & TIMELINE_GRAPH ){ |
| 212 | pGraph = graph_init(); |
| 213 | /* style is not moved to css, because this is |
| 214 | ** a technical div for the timeline graph |
| 215 | */ |
| 216 | @ <div id="canvas" style="position:relative;width:1px;height:1px;" |
| 217 | @ onclick="clickOnGraph(event)"></div> |
| 218 | } |
| 219 | db_static_prepare(&qbranch, |
| 220 | "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", |
| 221 | TAG_BRANCH |
| 222 | ); |
| 223 | |
| 224 | @ <table id="timelineTable" class="timelineTable"> |
| 225 | blob_zero(&comment); |
| 226 | while( db_step(pQuery)==SQLITE_ROW ){ |
| 227 | int rid = db_column_int(pQuery, 0); |
| 228 | const char *zUuid = db_column_text(pQuery, 1); |
| 229 | int isLeaf = db_column_int(pQuery, 5); |
| @@ -727,42 +728,16 @@ | |
| 727 | @ for(var i in rowinfo){ |
| 728 | @ rowinfo[i].y = absoluteY("m"+rowinfo[i].id) + 10 - canvasY; |
| 729 | @ rowinfo[i].x = left + rowinfo[i].r*railPitch; |
| 730 | @ } |
| 731 | @ var btm = absoluteY("grbtm") + 10 - canvasY; |
| 732 | #if 0 |
| 733 | @ if( btm<32768 ){ |
| 734 | @ canvasDiv.innerHTML = '<canvas id="timeline-canvas" '+ |
| 735 | @ 'style="position:absolute;left:'+(left-5)+'px;"' + |
| 736 | @ ' width="'+width+'" height="'+btm+'"><'+'/canvas>'; |
| 737 | @ realCanvas = gebi('timeline-canvas'); |
| 738 | @ }else{ |
| 739 | @ realCanvas = 0; |
| 740 | @ } |
| 741 | @ var context; |
| 742 | @ if( realCanvas && realCanvas.getContext |
| 743 | @ && (context = realCanvas.getContext('2d'))) { |
| 744 | @ drawBox = function(color,x0,y0,x1,y1) { |
| 745 | @ if( y0>32767 || y1>32767 ) return; |
| 746 | @ if( x0>x1 ){ var t=x0; x0=x1; x1=t; } |
| 747 | @ if( y0>y1 ){ var t=y0; y0=y1; y1=t; } |
| 748 | @ if(isNaN(x0) || isNaN(y0) || isNaN(x1) || isNaN(y1)) return; |
| 749 | @ context.fillStyle = color; |
| 750 | @ context.fillRect(x0-left+5,y0,x1-x0+1,y1-y0+1); |
| 751 | @ }; |
| 752 | @ } |
| 753 | #endif |
| 754 | @ for(var i in rowinfo){ |
| 755 | @ drawNode(rowinfo[i], left, btm); |
| 756 | @ } |
| 757 | @ if( selRow!=null ) clickOnRow(selRow); |
| 758 | @ } |
| 759 | @ function clickOnGraph(event){ |
| 760 | #ifdef OMIT_IE8_SUPPORT |
| 761 | @ var x=event.clientX-absoluteX("canvas")+window.pageXOffset; |
| 762 | @ var y=event.clientY-absoluteY("canvas")+window.pageYOffset; |
| 763 | #else |
| 764 | @ var x=event.clientX-absoluteX("canvas"); |
| 765 | @ var y=event.clientY-absoluteY("canvas"); |
| 766 | @ if(window.pageXOffset!=null){ |
| 767 | @ x += window.pageXOffset; |
| 768 | @ y += window.pageYOffset; |
| @@ -770,16 +745,18 @@ | |
| 770 | @ var d = window.document.documentElement; |
| 771 | @ if(document.compatMode!="CSS1Compat") d = d.body; |
| 772 | @ x += d.scrollLeft; |
| 773 | @ y += d.scrollTop; |
| 774 | @ } |
| 775 | #endif |
| 776 | @ for(var i in rowinfo){ |
| 777 | @ p = rowinfo[i]; |
| 778 | @ if( p.y<y-10 ) continue; |
| 779 | @ if( p.y>y+10 ) break; |
| 780 | @ if( p.x>x-10 && p.x<x+10 ){ |
| 781 | @ clickOnRow(p); |
| 782 | @ break; |
| 783 | @ } |
| 784 | @ } |
| 785 | @ } |
| 786 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -211,19 +211,20 @@ | |
| 211 | if( tmFlags & TIMELINE_GRAPH ){ |
| 212 | pGraph = graph_init(); |
| 213 | /* style is not moved to css, because this is |
| 214 | ** a technical div for the timeline graph |
| 215 | */ |
| 216 | @ <div id="canvas" style="position:relative;height:0px;width:0px;" |
| 217 | @ onclick="clickOnGraph(event)"></div> |
| 218 | } |
| 219 | db_static_prepare(&qbranch, |
| 220 | "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", |
| 221 | TAG_BRANCH |
| 222 | ); |
| 223 | |
| 224 | @ <table id="timelineTable" class="timelineTable" |
| 225 | @ onclick="clickOnGraph(event)"> |
| 226 | blob_zero(&comment); |
| 227 | while( db_step(pQuery)==SQLITE_ROW ){ |
| 228 | int rid = db_column_int(pQuery, 0); |
| 229 | const char *zUuid = db_column_text(pQuery, 1); |
| 230 | int isLeaf = db_column_int(pQuery, 5); |
| @@ -727,42 +728,16 @@ | |
| 728 | @ for(var i in rowinfo){ |
| 729 | @ rowinfo[i].y = absoluteY("m"+rowinfo[i].id) + 10 - canvasY; |
| 730 | @ rowinfo[i].x = left + rowinfo[i].r*railPitch; |
| 731 | @ } |
| 732 | @ var btm = absoluteY("grbtm") + 10 - canvasY; |
| 733 | @ for(var i in rowinfo){ |
| 734 | @ drawNode(rowinfo[i], left, btm); |
| 735 | @ } |
| 736 | @ if( selRow!=null ) clickOnRow(selRow); |
| 737 | @ } |
| 738 | @ function clickOnGraph(event){ |
| 739 | @ var x=event.clientX-absoluteX("canvas"); |
| 740 | @ var y=event.clientY-absoluteY("canvas"); |
| 741 | @ if(window.pageXOffset!=null){ |
| 742 | @ x += window.pageXOffset; |
| 743 | @ y += window.pageYOffset; |
| @@ -770,16 +745,18 @@ | |
| 745 | @ var d = window.document.documentElement; |
| 746 | @ if(document.compatMode!="CSS1Compat") d = d.body; |
| 747 | @ x += d.scrollLeft; |
| 748 | @ y += d.scrollTop; |
| 749 | @ } |
| 750 | if( P("clicktest")!=0 ){ |
| 751 | @ alert("click at "+x+","+y) |
| 752 | } |
| 753 | @ for(var i in rowinfo){ |
| 754 | @ p = rowinfo[i]; |
| 755 | @ if( p.y<y-11 ) continue; |
| 756 | @ if( p.y>y+9 ) break; |
| 757 | @ if( p.x>x-11 && p.x<x+9 ){ |
| 758 | @ clickOnRow(p); |
| 759 | @ break; |
| 760 | @ } |
| 761 | @ } |
| 762 | @ } |
| 763 |