@@ -49,6 +49,7 @@ class GitGraphView {
4949 private readonly viewElem : HTMLElement ;
5050 private readonly controlsElem : HTMLElement ;
5151 private readonly tableElem : HTMLElement ;
52+ private tableColHeadersElem : HTMLElement | null ;
5253 private readonly footerElem : HTMLElement ;
5354 private readonly showRemoteBranchesElem : HTMLInputElement ;
5455 private readonly refreshBtnElem : HTMLElement ;
@@ -72,6 +73,7 @@ class GitGraphView {
7273
7374 this . controlsElem = document . getElementById ( 'controls' ) ! ;
7475 this . tableElem = document . getElementById ( 'commitTable' ) ! ;
76+ this . tableColHeadersElem = document . getElementById ( 'tableColHeaders' ) ! ;
7577 this . footerElem = document . getElementById ( 'footer' ) ! ;
7678 this . scrollShadowElem = < HTMLInputElement > document . getElementById ( 'scrollShadow' ) ! ;
7779
@@ -921,6 +923,11 @@ class GitGraphView {
921923 }
922924 }
923925 }
926+
927+ if ( this . config . stickyHeader ) {
928+ this . tableColHeadersElem = document . getElementById ( 'tableColHeaders' ) ;
929+ this . alignTableHeaderToControls ( ) ;
930+ }
924931 }
925932
926933 private renderUncommittedChanges ( ) {
@@ -1882,6 +1889,22 @@ class GitGraphView {
18821889 this . requestLoadRepoInfoAndCommits ( false , true ) ;
18831890 }
18841891
1892+ private alignTableHeaderToControls ( ) {
1893+ if ( ! this . tableColHeadersElem ) {
1894+ return ;
1895+ }
1896+
1897+ const controlsHeight = this . controlsElem . offsetHeight ;
1898+ const controlsWidth = this . controlsElem . offsetWidth ;
1899+ const tableColHeadersHeight = this . tableColHeadersElem . offsetHeight ;
1900+ const bottomBorderWidth = 1 ;
1901+ const shadowYPos = controlsHeight + tableColHeadersHeight + bottomBorderWidth ;
1902+
1903+ this . tableColHeadersElem . style . top = `${ controlsHeight } px` ;
1904+ this . scrollShadowElem . style . top = `${ shadowYPos } px` ;
1905+ this . scrollShadowElem . style . width = `${ controlsWidth } px` ;
1906+ }
1907+
18851908
18861909 /* Observers */
18871910
@@ -1894,6 +1917,10 @@ class GitGraphView {
18941917 windowWidth = window . outerWidth ;
18951918 windowHeight = window . outerHeight ;
18961919 }
1920+
1921+ if ( this . config . stickyHeader ) {
1922+ this . alignTableHeaderToControls ( ) ;
1923+ }
18971924 } ) ;
18981925 }
18991926
0 commit comments