Skip to content

Commit

Permalink
update: expose setScroll api from render (#3660)
Browse files Browse the repository at this point in the history
  • Loading branch information
leyiang authored Apr 15, 2024
1 parent a9b08d0 commit 4cfde29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class Renderer extends EventEmitter<RendererEvents> {
return this.scrollContainer.scrollLeft
}

private setScroll(pixels: number) {
setScroll(pixels: number) {
this.scrollContainer.scrollLeft = pixels
}

Expand Down
5 changes: 5 additions & 0 deletions src/wavesurfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ class WaveSurfer extends Player<WaveSurferEvents> {
return this.renderer.getScroll()
}

/** Set the current scroll position in pixels */
public setScroll(pixels: number) {
return this.renderer.setScroll(pixels)
}

/** Move the start of the viewing window to a specific time in the audio (in seconds) */
public setScrollTime(time: number) {
const percentage = time / this.getDuration()
Expand Down

0 comments on commit 4cfde29

Please sign in to comment.