Fix bug where play after paste used old selection state

This commit is contained in:
Eric Rosenbaum committed 2019-07-23 17:51:46 -04:00
1 parent 0f17157a3d
commit 75dbed61fa
1 file changed
+3 -5
+3 -5
View File
@@ -334,6 +334,7 @@ class SoundEditor extends React.Component {
newSamples.set(this.props.samples, 0);
newSamples.set(this.state.copyBuffer.samples, this.props.samples.length);
this.submitNewSamples(newSamples, this.props.sampleRate, false);
this.handlePlay();
} else {
// else replace the selection with the pasted sound
const trimStartSamples = this.state.trimStart * this.props.samples.length;
@@ -352,15 +353,12 @@ class SoundEditor extends React.Component {
const newDurationSeconds = newSamples.length / this.state.copyBuffer.sampleRate;
const adjustedTrimStart = trimStartSeconds / newDurationSeconds;
const adjustedTrimEnd = trimEndSeconds / newDurationSeconds;
this.submitNewSamples(newSamples, this.props.sampleRate, false);
this.setState({
trimStart: adjustedTrimStart,
trimEnd: adjustedTrimEnd
});
this.submitNewSamples(newSamples, this.props.sampleRate, false);
}, this.handlePlay);
}
this.handlePlay();
}
handlePaste () {
if (!this.state.copyBuffer) return;