From a2cc320d1ffe64a1d1f59b7d9f62e1467e20f17f Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Tue, 15 Jan 2019 15:25:26 -0500 Subject: [PATCH] Clear trim handles if trim cannot be completed. There was a useability issue discovered in testing where trying to trim a sound to be of zero length would fail, but just leave the trimmers active. Clear them out, since the trim is invalid --- src/containers/sound-editor.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/containers/sound-editor.jsx b/src/containers/sound-editor.jsx index 631aa65eb..a3cdaaf67 100644 --- a/src/containers/sound-editor.jsx +++ b/src/containers/sound-editor.jsx @@ -136,6 +136,12 @@ class SoundEditor extends React.Component { if (endIndex > startIndex) { // Strictly greater to prevent 0 sample sounds const clippedSamples = samples.slice(startIndex, endIndex); this.submitNewSamples(clippedSamples, sampleRate); + } else { + // Just clear the trim state, it cannot be completed + this.setState({ + trimStart: null, + trimEnd: null + }); } } }