You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a CustomCenteredZoomState class which extends ui.states.CenteredZoomState. I see the example to prevent the timeline.offset from going negative, but I'm struggling with how to limit the user from scrolling the waveform infinitely in the positive direction.
I see Example 2, but I'm not sure the best way to get the view.width in this class? I would like to limit dragging to the maximum of the audio track if that makes sense. I'll keep working at it, just wondering if this is something that has already been solved...
// Example 1: Prevent timeline.offset to be negative
timeContext.offset = Math.min(timeContext.offset, 0);
//
// Example 2: Keep in container when zoomed out
// if (timeContext.stretchRatio < 1) {
// const minOffset = timeContext.timeToPixel.invert(0);
// const maxOffset = timeContext.timeToPixel.invert(view.width - timeContext.timeToPixel(timeContext.duration));
// timeContext.offset = Math.max(timeContext.offset, minOffset);
// timeContext.offset = Math.min(timeContext.offset, maxOffset);
// }
The text was updated successfully, but these errors were encountered:
I have created a
CustomCenteredZoomState
class which extendsui.states.CenteredZoomState
. I see the example to prevent the timeline.offset from going negative, but I'm struggling with how to limit the user from scrolling the waveform infinitely in the positive direction.I see Example 2, but I'm not sure the best way to get the view.width in this class? I would like to limit dragging to the maximum of the audio track if that makes sense. I'll keep working at it, just wondering if this is something that has already been solved...
The text was updated successfully, but these errors were encountered: