@@ -15,7 +15,13 @@ import {
1515 ViewChild
1616} from '@angular/core' ;
1717import { ActivatedRoute , ParamMap } from '@angular/router' ;
18- import { isEqualIgnoreFunctions , NavigationService , NumberCoercer , TypedSimpleChanges } from '@hypertrace/common' ;
18+ import {
19+ DomElementMeasurerService ,
20+ isEqualIgnoreFunctions ,
21+ NavigationService ,
22+ NumberCoercer ,
23+ TypedSimpleChanges
24+ } from '@hypertrace/common' ;
1925import { without } from 'lodash-es' ;
2026import { BehaviorSubject , combineLatest , Observable } from 'rxjs' ;
2127import { filter , map } from 'rxjs/operators' ;
@@ -336,6 +342,7 @@ export class TableComponent
336342 private readonly changeDetector : ChangeDetectorRef ,
337343 private readonly navigationService : NavigationService ,
338344 private readonly activatedRoute : ActivatedRoute ,
345+ private readonly domElementMeasurerService : DomElementMeasurerService ,
339346 private readonly tableService : TableService
340347 ) {
341348 combineLatest ( [ this . activatedRoute . queryParamMap , this . columnConfigs$ ] )
@@ -437,19 +444,16 @@ export class TableComponent
437444
438445 private buildColumnInfo ( index : number ) : ColumnInfo {
439446 const element = this . queryHeaderCellElement ( index ) ;
447+ const boundingBox = this . domElementMeasurerService . measureHtmlElement ( element ) ;
440448
441449 return {
442450 config : this . getVisibleColumnConfig ( index ) ,
443451 element : element ,
444- bounds : this . calcBounds ( element )
445- } ;
446- }
447-
448- private calcBounds ( element : HTMLElement ) : ColumnBounds {
449- // We add additional padding so a portion of the column remains visible to resize (asymmetry due to resize-handle)
450- return {
451- left : element . offsetLeft + 12 ,
452- right : element . offsetLeft + element . offsetWidth - 8
452+ bounds : {
453+ // We add additional padding so a portion of the column remains visible to resize (asymmetry due to resize-handle)
454+ left : boundingBox . left + 12 ,
455+ right : boundingBox . left + boundingBox . width - 8
456+ }
453457 } ;
454458 }
455459
0 commit comments