Skip to content

Commit

Permalink
Use offsetWidth and offsetHeight to ensure correct marked placement w…
Browse files Browse the repository at this point in the history
…hen scaling is applied
  • Loading branch information
HalfbyteHeroes committed Nov 7, 2024
1 parent d665c35 commit 4a3674c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/ts/components/seekbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,11 @@ export class SeekBar extends Component<SeekBarConfig> {
cssPrefix: this.config.cssPrefix,
snappingRange: this.config.snappingRange,
};
this.timelineMarkersHandler = new TimelineMarkersHandler(timelineMarkerConfig, () => this.seekBar.width(), this.seekBarMarkersContainer);
this.timelineMarkersHandler = new TimelineMarkersHandler(
timelineMarkerConfig,
() => this.seekBar.offsetWidth(),
this.seekBarMarkersContainer,
);
this.timelineMarkersHandler.initialize(player, uimanager);
}

Expand Down Expand Up @@ -891,10 +895,12 @@ export class SeekBar extends Component<SeekBarConfig> {
this.setPosition(this.seekBarPlaybackPosition, percent);

// Set position of the marker
let totalSize = (this.config.vertical ? (this.seekBar.height() - this.seekBarPlaybackPositionMarker.height()) : this.seekBar.width());
let totalSize = this.config.vertical
? (this.seekBar.offsetHeight() - this.seekBarPlaybackPositionMarker.height())
: this.seekBar.offsetWidth();
let px = (totalSize) / 100 * percent;
if (this.config.vertical) {
px = this.seekBar.height() - px - this.seekBarPlaybackPositionMarker.height();
px = this.seekBar.offsetHeight() - px - this.seekBarPlaybackPositionMarker.offsetHeight();
}

let style = this.config.vertical ?
Expand Down

0 comments on commit 4a3674c

Please sign in to comment.