Button to copy settings to the other side

This commit is contained in:
Jake Archibald
2018-08-22 18:03:41 +01:00
parent ea5d3c2d78
commit 4db43ccd4e
3 changed files with 114 additions and 91 deletions

View File

@@ -224,6 +224,14 @@ export default class App extends Component<Props, State> {
await this.updateFile(file);
}
onCopyToOtherClick(index: 0 | 1) {
const otherIndex = (index + 1) % 2;
this.setState({
images: cleanSet(this.state.images, otherIndex, this.state.images[index]),
});
}
async updateFile(file: File) {
this.setState({ loading: true });
try {
@@ -365,6 +373,7 @@ export default class App extends Component<Props, State> {
onEncoderTypeChange={this.onEncoderTypeChange.bind(this, index)}
onEncoderOptionsChange={this.onEncoderOptionsChange.bind(this, index)}
onPreprocessorOptionsChange={this.onPreprocessorOptionsChange.bind(this, index)}
onCopyToOtherClick={this.onCopyToOtherClick.bind(this, index)}
/>
))}
{anyLoading && <span style={{ position: 'fixed', top: 0, left: 0 }}>Loading...</span>}