@@ -15,7 +15,13 @@ import {
15
15
ViewChild
16
16
} from '@angular/core' ;
17
17
import { 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' ;
19
25
import { without } from 'lodash-es' ;
20
26
import { BehaviorSubject , combineLatest , Observable } from 'rxjs' ;
21
27
import { filter , map } from 'rxjs/operators' ;
@@ -336,6 +342,7 @@ export class TableComponent
336
342
private readonly changeDetector : ChangeDetectorRef ,
337
343
private readonly navigationService : NavigationService ,
338
344
private readonly activatedRoute : ActivatedRoute ,
345
+ private readonly domElementMeasurerService : DomElementMeasurerService ,
339
346
private readonly tableService : TableService
340
347
) {
341
348
combineLatest ( [ this . activatedRoute . queryParamMap , this . columnConfigs$ ] )
@@ -437,19 +444,16 @@ export class TableComponent
437
444
438
445
private buildColumnInfo ( index : number ) : ColumnInfo {
439
446
const element = this . queryHeaderCellElement ( index ) ;
447
+ const boundingBox = this . domElementMeasurerService . measureHtmlElement ( element ) ;
440
448
441
449
return {
442
450
config : this . getVisibleColumnConfig ( index ) ,
443
451
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
+ }
453
457
} ;
454
458
}
455
459
0 commit comments