Skip to content

Commit

Permalink
TimelinePlugin: try to retrieve wrapper scrollWidth value from wavesu…
Browse files Browse the repository at this point in the history
…rfer wrapper when computing pxPerSec in initTimeline() (#3743)
  • Loading branch information
alexanderleecii authored Jun 15, 2024
1 parent 9336f80 commit 90c6cd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class TimelinePlugin extends BasePlugin<TimelinePluginEvents, TimelinePluginOpti

private initTimeline() {
const duration = this.wavesurfer?.getDuration() ?? this.options.duration ?? 0
const pxPerSec = this.timelineWrapper.scrollWidth / duration
const pxPerSec = (this.wavesurfer?.getWrapper().scrollWidth || this.timelineWrapper.scrollWidth) / duration
const timeInterval = this.options.timeInterval ?? this.defaultTimeInterval(pxPerSec)
const primaryLabelInterval = this.options.primaryLabelInterval ?? this.defaultPrimaryLabelInterval(pxPerSec)
const primaryLabelSpacing = this.options.primaryLabelSpacing
Expand Down

0 comments on commit 90c6cd4

Please sign in to comment.