@@ -48,6 +48,7 @@ class GitGraphView {
4848 private readonly viewElem : HTMLElement ;
4949 private readonly controlsElem : HTMLElement ;
5050 private readonly tableElem : HTMLElement ;
51+ private tableColHeadersElem : HTMLElement | null ;
5152 private readonly footerElem : HTMLElement ;
5253 private readonly showRemoteBranchesElem : HTMLInputElement ;
5354 private readonly refreshBtnElem : HTMLElement ;
@@ -71,6 +72,7 @@ class GitGraphView {
7172
7273 this . controlsElem = document . getElementById ( 'controls' ) ! ;
7374 this . tableElem = document . getElementById ( 'commitTable' ) ! ;
75+ this . tableColHeadersElem = document . getElementById ( 'tableColHeaders' ) ! ;
7476 this . footerElem = document . getElementById ( 'footer' ) ! ;
7577 this . scrollShadowElem = < HTMLInputElement > document . getElementById ( 'scrollShadow' ) ! ;
7678
@@ -911,6 +913,11 @@ class GitGraphView {
911913 }
912914 }
913915 }
916+
917+ if ( this . config . stickyHeader ) {
918+ this . tableColHeadersElem = document . getElementById ( 'tableColHeaders' ) ;
919+ this . alignTableHeaderToControls ( ) ;
920+ }
914921 }
915922
916923 private renderUncommittedChanges ( ) {
@@ -1820,6 +1827,22 @@ class GitGraphView {
18201827 this . requestLoadRepoInfoAndCommits ( false , true ) ;
18211828 }
18221829
1830+ private alignTableHeaderToControls ( ) {
1831+ if ( ! this . tableColHeadersElem ) {
1832+ return ;
1833+ }
1834+
1835+ const controlsHeight = this . controlsElem . offsetHeight ;
1836+ const controlsWidth = this . controlsElem . offsetWidth ;
1837+ const tableColHeadersHeight = this . tableColHeadersElem . offsetHeight ;
1838+ const bottomBorderWidth = 1 ;
1839+ const shadowYPos = controlsHeight + tableColHeadersHeight + bottomBorderWidth ;
1840+
1841+ this . tableColHeadersElem . style . top = `${ controlsHeight } px` ;
1842+ this . scrollShadowElem . style . top = `${ shadowYPos } px` ;
1843+ this . scrollShadowElem . style . width = `${ controlsWidth } px` ;
1844+ }
1845+
18231846
18241847 /* Observers */
18251848
@@ -1832,6 +1855,10 @@ class GitGraphView {
18321855 windowWidth = window . outerWidth ;
18331856 windowHeight = window . outerHeight ;
18341857 }
1858+
1859+ if ( this . config . stickyHeader ) {
1860+ this . alignTableHeaderToControls ( ) ;
1861+ }
18351862 } ) ;
18361863 }
18371864
0 commit comments