bbc / peaks.js

JavaScript UI component for interacting with audio waveforms
https://waveform.prototyping.bbc.co.uk
GNU Lesser General Public License v3.0
3.16k stars 277 forks source link

Added functions to disable seek and drag/scroll interactions #424

Closed chrisn closed 2 years ago

chrisn commented 2 years ago

See #421. This PR adds new functions to allow applications to disable seek and drag/scroll interactions.

To disable drag/scroll in the zoomable waveform view:

const zoomview = peaksInstance.views.getView('zoomview');
zoomview.enableDragScroll(false); // or true to re-enable

To disable seek on click (actually on mouse-up):

const overview = peaksInstance.views.getView('overview');
const zoomview = peaksInstance.views.getView('zoomview');

overview.enableSeek(false); // or true to re-enable
zoomview.enableSeek(false);

How is this, @rowild?

rowild commented 2 years ago

Just tested these functions: they work great! It's awesome to have them available on peaks-level! Thank you very much!