Skip to content

Commit

Permalink
fix(timeline): Fix timeline flickering when zooming timeline
Browse files Browse the repository at this point in the history
Fix timeline flickering on zooming by removing rendering deferral
  • Loading branch information
acieslewicz committed Oct 22, 2024
1 parent 41ba375 commit 887676c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/plugins/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ class TimelinePlugin extends BasePlugin<TimelinePluginEvents, TimelinePluginOpti
}
}

setTimeout(() => {
if (!this.wavesurfer) return
const scrollLeft = this.wavesurfer.getScroll()
const scrollRight = scrollLeft + this.wavesurfer.getWidth()
renderIfVisible(scrollLeft, scrollRight)
this.subscriptions.push(
this.wavesurfer.on('scroll', (_start, _end, scrollLeft, scrollRight) => {
renderIfVisible(scrollLeft, scrollRight)
}),
)
}, 0)
if (!this.wavesurfer) return
const scrollLeft = this.wavesurfer.getScroll()
const scrollRight = scrollLeft + this.wavesurfer.getWidth()

renderIfVisible(scrollLeft, scrollRight)

this.subscriptions.push(
this.wavesurfer.on('scroll', (_start, _end, scrollLeft, scrollRight) => {
renderIfVisible(scrollLeft, scrollRight)
}),
)
}

private initTimeline() {
Expand Down

0 comments on commit 887676c

Please sign in to comment.