@@ -45,6 +45,7 @@ class GitGraphView {
4545private readonly viewElem : HTMLElement ;
4646private readonly controlsElem : HTMLElement ;
4747private readonly tableElem : HTMLElement ;
48+ private tableColHeadersElem : HTMLElement | null ;
4849private readonly footerElem : HTMLElement ;
4950private readonly showRemoteBranchesElem : HTMLInputElement ;
5051private readonly refreshBtnElem : HTMLElement ;
@@ -66,6 +67,7 @@ class GitGraphView {
6667
6768this . controlsElem = document . getElementById ( 'controls' ) ! ;
6869this . tableElem = document . getElementById ( 'commitTable' ) ! ;
70+ this . tableColHeadersElem = document . getElementById ( 'tableColHeaders' ) ! ;
6971this . footerElem = document . getElementById ( 'footer' ) ! ;
7072this . scrollShadowElem = < HTMLInputElement > document . getElementById ( 'scrollShadow' ) ! ;
7173
@@ -839,6 +841,11 @@ class GitGraphView {
839841}
840842}
841843}
844+
845+ if ( this . config . stickyHeader ) {
846+ this . tableColHeadersElem = document . getElementById ( 'tableColHeaders' ) ;
847+ this . alignTableHeaderToControls ( ) ;
848+ }
842849}
843850
844851private renderUncommittedChanges ( ) {
@@ -1746,6 +1753,22 @@ class GitGraphView {
17461753this . requestLoadRepoInfoAndCommits ( false , true ) ;
17471754}
17481755
1756+ private alignTableHeaderToControls ( ) {
1757+ if ( ! this . tableColHeadersElem ) {
1758+ return ;
1759+ }
1760+
1761+ const controlsHeight = this . controlsElem . offsetHeight ;
1762+ const controlsWidth = this . controlsElem . offsetWidth ;
1763+ const tableColHeadersHeight = this . tableColHeadersElem . offsetHeight ;
1764+ const bottomBorderWidth = 1 ;
1765+ const shadowYPos = controlsHeight + tableColHeadersHeight + bottomBorderWidth ;
1766+
1767+ this . tableColHeadersElem . style . top = `${ controlsHeight } px` ;
1768+ this . scrollShadowElem . style . top = `${ shadowYPos } px` ;
1769+ this . scrollShadowElem . style . width = `${ controlsWidth } px` ;
1770+ }
1771+
17491772
17501773/* Observers */
17511774
@@ -1758,6 +1781,10 @@ class GitGraphView {
17581781windowWidth = window . outerWidth ;
17591782windowHeight = window . outerHeight ;
17601783}
1784+
1785+ if ( this . config . stickyHeader ) {
1786+ this . alignTableHeaderToControls ( ) ;
1787+ }
17611788} ) ;
17621789}
17631790
0 commit comments