mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 00:37:19 +00:00
Hiding "edit" when "original image"
This commit is contained in:
@@ -142,40 +142,46 @@ export default class Options extends Component<Props, State> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={style.options}>
|
<div class={style.options}>
|
||||||
<h2 class={style.optionsTitle}>Edit</h2>
|
|
||||||
<label class={style.sectionEnabler}>
|
|
||||||
<Checkbox
|
|
||||||
name="resize.enable"
|
|
||||||
checked={!!preprocessorState.resize.enabled}
|
|
||||||
onChange={this.onPreprocessorEnabledChange}
|
|
||||||
/>
|
|
||||||
Resize
|
|
||||||
</label>
|
|
||||||
<Expander>
|
<Expander>
|
||||||
{preprocessorState.resize.enabled ?
|
{encoderState.type === identity.type ? null :
|
||||||
<ResizeOptionsComponent
|
<div>
|
||||||
isVector={Boolean(source && source.vectorImage)}
|
<h2 class={style.optionsTitle}>Edit</h2>
|
||||||
aspect={source ? (source.data.width / source.data.height) : 1}
|
<label class={style.sectionEnabler}>
|
||||||
options={preprocessorState.resize}
|
<Checkbox
|
||||||
onChange={this.onResizeOptionsChange}
|
name="resize.enable"
|
||||||
/>
|
checked={!!preprocessorState.resize.enabled}
|
||||||
: null}
|
onChange={this.onPreprocessorEnabledChange}
|
||||||
</Expander>
|
/>
|
||||||
<label class={style.sectionEnabler}>
|
Resize
|
||||||
<Checkbox
|
</label>
|
||||||
name="quantizer.enable"
|
<Expander>
|
||||||
checked={!!preprocessorState.quantizer.enabled}
|
{preprocessorState.resize.enabled ?
|
||||||
onChange={this.onPreprocessorEnabledChange}
|
<ResizeOptionsComponent
|
||||||
/>
|
isVector={Boolean(source && source.vectorImage)}
|
||||||
Reduce palette
|
aspect={source ? (source.data.width / source.data.height) : 1}
|
||||||
</label>
|
options={preprocessorState.resize}
|
||||||
<Expander>
|
onChange={this.onResizeOptionsChange}
|
||||||
{preprocessorState.quantizer.enabled ?
|
/>
|
||||||
<QuantizerOptionsComponent
|
: null}
|
||||||
options={preprocessorState.quantizer}
|
</Expander>
|
||||||
onChange={this.onQuantizerOptionsChange}
|
<label class={style.sectionEnabler}>
|
||||||
/>
|
<Checkbox
|
||||||
: null}
|
name="quantizer.enable"
|
||||||
|
checked={!!preprocessorState.quantizer.enabled}
|
||||||
|
onChange={this.onPreprocessorEnabledChange}
|
||||||
|
/>
|
||||||
|
Reduce palette
|
||||||
|
</label>
|
||||||
|
<Expander>
|
||||||
|
{preprocessorState.quantizer.enabled ?
|
||||||
|
<QuantizerOptionsComponent
|
||||||
|
options={preprocessorState.quantizer}
|
||||||
|
onChange={this.onQuantizerOptionsChange}
|
||||||
|
/>
|
||||||
|
: null}
|
||||||
|
</Expander>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</Expander>
|
</Expander>
|
||||||
|
|
||||||
<h2 class={style.optionsTitle}>Compress</h2>
|
<h2 class={style.optionsTitle}>Compress</h2>
|
||||||
@@ -193,16 +199,18 @@ export default class Options extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{EncoderOptionComponent &&
|
<Expander>
|
||||||
<EncoderOptionComponent
|
{EncoderOptionComponent ?
|
||||||
options={
|
<EncoderOptionComponent
|
||||||
// Casting options, as encoderOptionsComponentMap[encodeData.type] ensures
|
options={
|
||||||
// the correct type, but typescript isn't smart enough.
|
// Casting options, as encoderOptionsComponentMap[encodeData.type] ensures
|
||||||
encoderState.options as any
|
// the correct type, but typescript isn't smart enough.
|
||||||
}
|
encoderState.options as any
|
||||||
onChange={onEncoderOptionsChange}
|
}
|
||||||
/>
|
onChange={onEncoderOptionsChange}
|
||||||
}
|
/>
|
||||||
|
: null}
|
||||||
|
</Expander>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/*
|
{/*
|
||||||
|
|||||||
Reference in New Issue
Block a user