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.

drh 2017-11-26 23:19 trunk
Commit 66e6c97bd4c955769b3a86962e33061bc298a42b5f5a5e5d5716d3686f3d877c
1 file changed +9
--- src/timeline.c
+++ src/timeline.c
@@ -1172,10 +1172,18 @@
11721172
@ gebi("detail-"+id).style.display='inline';
11731173
@ x = document.getElementById("links-"+id);
11741174
@ if(x) x.style.display='inline';
11751175
@ }
11761176
@ 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
+ @ }
11771185
@ }
11781186
@ var lastRow = gebi("m"+rowinfo[rowinfo.length-1].id);
11791187
@ var lastY = 0;
11801188
@ function checkHeight(){
11811189
@ var h = absoluteY(lastRow);
@@ -1185,10 +1193,11 @@
11851193
@ }
11861194
@ setTimeout(checkHeight, 1000);
11871195
@ }
11881196
@ initGraph();
11891197
@ checkHeight();
1198
+ @ scrollToSelected();
11901199
@ </script>
11911200
}
11921201
}
11931202
11941203
/*
11951204
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button