diff --git a/example/zoom/main.js b/example/zoom/main.js
index e08853865..33161a51e 100644
--- a/example/zoom/main.js
+++ b/example/zoom/main.js
@@ -10,7 +10,25 @@ document.addEventListener('DOMContentLoaded', function () {
container: document.querySelector('#waveform'),
waveColor: '#A8DBA8',
progressColor: '#3B8686',
- backend: 'MediaElement'
+ backend: 'MediaElement',
+ plugins: [
+ WaveSurfer.regions.create({
+ regions: [
+ {
+ start: 0,
+ end: 5,
+ color: 'hsla(400, 100%, 30%, 0.1)'
+ }, {
+ start: 10,
+ end: 100,
+ color: 'hsla(200, 50%, 70%, 0.1)'
+ }
+ ]
+ }),
+ WaveSurfer.timeline.create({
+ container: '#timeline'
+ })
+ ]
});
diff --git a/src/plugin/timeline.js b/src/plugin/timeline.js
index ce1739de1..c97bd3849 100644
--- a/src/plugin/timeline.js
+++ b/src/plugin/timeline.js
@@ -126,6 +126,7 @@ export default class TimelinePlugin {
this.canvases = [];
+ this._onZoom = () => this.render();
this._onScroll = () => {
if (this.wrapper && this.drawer.wrapper) {
this.wrapper.scrollLeft = this.drawer.wrapper.scrollLeft;
@@ -142,6 +143,7 @@ export default class TimelinePlugin {
this.render();
ws.drawer.wrapper.addEventListener('scroll', this._onScroll);
ws.on('redraw', this._onRedraw);
+ ws.on('zoom', this._onZoom);
};
}
@@ -156,6 +158,7 @@ export default class TimelinePlugin {
destroy() {
this.unAll();
this.wavesurfer.un('redraw', this._onRedraw);
+ this.wavesurfer.un('zoom', this._onZoom);
this.wavesurfer.un('ready', this._onReady);
this.wavesurfer.drawer.wrapper.removeEventListener('scroll', this._onScroll);
if (this.wrapper && this.wrapper.parentNode) {