Skip to content

Commit

Permalink
fix lint-ts complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
oberhamsi committed Nov 13, 2023
1 parent 35d4956 commit ecb8ce5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ts/components/seekbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class SeekBar extends Component<SeekBarConfig> {
tabIndex: 0,
snappingRange: 1,
enableSeekPreview: true,
preventSeekPreviewOverflow: false
preventSeekPreviewOverflow: false,
}, this.config);

this.label = this.config.label;
Expand Down Expand Up @@ -1024,21 +1024,21 @@ export class SeekBar extends Component<SeekBarConfig> {
if (this.label) {
this.label.getDomElement().css({
'left': seekPositionPercentage + '%',
'transform': null
'transform': null,
});
if (this.config.preventSeekPreviewOverflow) {
const uiBounding = this.uimanager.getUI().getDomElement().get(0).getBoundingClientRect();
const labelBounding = this.label.getDomElement().get(0).getBoundingClientRect();
let preventOverflowOffset = 0;
if ((labelBounding.right - labelBounding.width/2 ) > uiBounding.right) {
preventOverflowOffset = -(labelBounding.width/2);
} else if ((labelBounding.left - labelBounding.width/2) < uiBounding.left) {
preventOverflowOffset = +(labelBounding.width/2);
if ((labelBounding.right - labelBounding.width / 2 ) > uiBounding.right) {
preventOverflowOffset = -(labelBounding.width / 2);
} else if ((labelBounding.left - labelBounding.width / 2) < uiBounding.left) {
preventOverflowOffset = +(labelBounding.width / 2);
}
if (preventOverflowOffset) {
this.label.getDomElement().css({
transform: `translateX(${preventOverflowOffset}px)`
})
transform: `translateX(${preventOverflowOffset}px)`,
});
}
}
}
Expand Down

0 comments on commit ecb8ce5

Please sign in to comment.