mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-13 09:17:20 +00:00
Button to copy settings to the other side
This commit is contained in:
@@ -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>}
|
||||
|
||||
Reference in New Issue
Block a user