Fossil SCM
If there is a selection or marked entry, scroll the /timeline so that the marked entry as as close to the middle of the screen as we can get, upon initial display of the timeline.
Commit
66e6c97bd4c955769b3a86962e33061bc298a42b5f5a5e5d5716d3686f3d877c
Parent
6fe8d46106113ae…
1 file changed
+9
+9
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1172,10 +1172,18 @@ | ||
| 1172 | 1172 | @ gebi("detail-"+id).style.display='inline'; |
| 1173 | 1173 | @ x = document.getElementById("links-"+id); |
| 1174 | 1174 | @ if(x) x.style.display='inline'; |
| 1175 | 1175 | @ } |
| 1176 | 1176 | @ checkHeight(); |
| 1177 | + @ } | |
| 1178 | + @ function scrollToSelected(){ | |
| 1179 | + @ var x = document.getElementsByClassName('timelineSelected'); | |
| 1180 | + @ if(x[0]){ | |
| 1181 | + @ var h = window.innerHeight; | |
| 1182 | + @ var y = absoluteY(x[0]) - h/2; | |
| 1183 | + @ if( y>0 ) window.scrollTo(0, y); | |
| 1184 | + @ } | |
| 1177 | 1185 | @ } |
| 1178 | 1186 | @ var lastRow = gebi("m"+rowinfo[rowinfo.length-1].id); |
| 1179 | 1187 | @ var lastY = 0; |
| 1180 | 1188 | @ function checkHeight(){ |
| 1181 | 1189 | @ var h = absoluteY(lastRow); |
| @@ -1185,10 +1193,11 @@ | ||
| 1185 | 1193 | @ } |
| 1186 | 1194 | @ setTimeout(checkHeight, 1000); |
| 1187 | 1195 | @ } |
| 1188 | 1196 | @ initGraph(); |
| 1189 | 1197 | @ checkHeight(); |
| 1198 | + @ scrollToSelected(); | |
| 1190 | 1199 | @ </script> |
| 1191 | 1200 | } |
| 1192 | 1201 | } |
| 1193 | 1202 | |
| 1194 | 1203 | /* |
| 1195 | 1204 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1172,10 +1172,18 @@ | |
| 1172 | @ gebi("detail-"+id).style.display='inline'; |
| 1173 | @ x = document.getElementById("links-"+id); |
| 1174 | @ if(x) x.style.display='inline'; |
| 1175 | @ } |
| 1176 | @ checkHeight(); |
| 1177 | @ } |
| 1178 | @ var lastRow = gebi("m"+rowinfo[rowinfo.length-1].id); |
| 1179 | @ var lastY = 0; |
| 1180 | @ function checkHeight(){ |
| 1181 | @ var h = absoluteY(lastRow); |
| @@ -1185,10 +1193,11 @@ | |
| 1185 | @ } |
| 1186 | @ setTimeout(checkHeight, 1000); |
| 1187 | @ } |
| 1188 | @ initGraph(); |
| 1189 | @ checkHeight(); |
| 1190 | @ </script> |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | /* |
| 1195 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1172,10 +1172,18 @@ | |
| 1172 | @ gebi("detail-"+id).style.display='inline'; |
| 1173 | @ x = document.getElementById("links-"+id); |
| 1174 | @ if(x) x.style.display='inline'; |
| 1175 | @ } |
| 1176 | @ checkHeight(); |
| 1177 | @ } |
| 1178 | @ function scrollToSelected(){ |
| 1179 | @ var x = document.getElementsByClassName('timelineSelected'); |
| 1180 | @ if(x[0]){ |
| 1181 | @ var h = window.innerHeight; |
| 1182 | @ var y = absoluteY(x[0]) - h/2; |
| 1183 | @ if( y>0 ) window.scrollTo(0, y); |
| 1184 | @ } |
| 1185 | @ } |
| 1186 | @ var lastRow = gebi("m"+rowinfo[rowinfo.length-1].id); |
| 1187 | @ var lastY = 0; |
| 1188 | @ function checkHeight(){ |
| 1189 | @ var h = absoluteY(lastRow); |
| @@ -1185,10 +1193,11 @@ | |
| 1193 | @ } |
| 1194 | @ setTimeout(checkHeight, 1000); |
| 1195 | @ } |
| 1196 | @ initGraph(); |
| 1197 | @ checkHeight(); |
| 1198 | @ scrollToSelected(); |
| 1199 | @ </script> |
| 1200 | } |
| 1201 | } |
| 1202 | |
| 1203 | /* |
| 1204 |