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
This commit is contained in:
Paul Kaplan committed 2019-01-15 15:25:26 -05:00
1 parent d4e1cfc48a
commit a2cc320d1f
1 file changed
+6
+6
View File
@@ -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
});
}
}
}