mirror of https://github.com/VERT-sh/VERT.git
fix: disable transparency option on jpeg
This commit is contained in:
parent
1761227d42
commit
1c65d37963
|
|
@ -117,6 +117,7 @@
|
|||
setting.key,
|
||||
value,
|
||||
)}
|
||||
disabled={setting.disabled}
|
||||
/>
|
||||
{#if setting.hasCustomInput}
|
||||
{@const disabled =
|
||||
|
|
@ -134,7 +135,8 @@
|
|||
] ??
|
||||
""}
|
||||
placeholder={setting.placeholder}
|
||||
{disabled}
|
||||
disabled={disabled ||
|
||||
setting.disabled}
|
||||
oninput={(e) =>
|
||||
handleSettingChange(
|
||||
setting.customInputKey!,
|
||||
|
|
@ -156,6 +158,7 @@
|
|||
setting.key,
|
||||
e.currentTarget.checked,
|
||||
)}
|
||||
disabled={setting.disabled}
|
||||
/>
|
||||
{:else if setting.type === "range"}
|
||||
{@const rangeValue = (settings[
|
||||
|
|
@ -170,7 +173,9 @@
|
|||
{@const rangeLabel =
|
||||
setting.options?.[rangeValue]
|
||||
?.label ?? rangeValue}
|
||||
<div class="flex items-center mt-2 gap-2">
|
||||
<div
|
||||
class="flex items-center mt-2 gap-2"
|
||||
>
|
||||
<input
|
||||
type="range"
|
||||
min={setting.min}
|
||||
|
|
@ -187,6 +192,7 @@
|
|||
nextValue,
|
||||
);
|
||||
}}
|
||||
disabled={setting.disabled}
|
||||
/>
|
||||
<span
|
||||
class="text-sm max-w-28 w-full text-right"
|
||||
|
|
@ -208,6 +214,7 @@
|
|||
setting.key,
|
||||
e.currentTarget.value,
|
||||
)}
|
||||
disabled={setting.disabled}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -116,7 +116,9 @@ export class MagickConverter extends Converter {
|
|||
}
|
||||
}
|
||||
|
||||
public async getAvailableSettings(): Promise<SettingDefinition[]> {
|
||||
public async getAvailableSettings(
|
||||
input: VertFile,
|
||||
): Promise<SettingDefinition[]> {
|
||||
// images - quality/compression/quantize/interlace/depth-DPI, resize, crop, rotate, flip/flop, autoOrient?, color space/bit depth, transparency settings
|
||||
const global = Settings.instance.settings;
|
||||
|
||||
|
|
@ -163,13 +165,15 @@ export class MagickConverter extends Converter {
|
|||
],
|
||||
};
|
||||
|
||||
// allow transparency or not
|
||||
// TODO: disable if jpg/jpeg input/output
|
||||
// TODO: check other formats for transparency support
|
||||
const fromJpeg = input.from === ".jpg" || input.from === ".jpeg" || input.from === ".jfif";
|
||||
const toJpeg = input.to === ".jpg" || input.to === ".jpeg" || input.to === ".jfif";
|
||||
const transparency: SettingDefinition = {
|
||||
key: "transparency",
|
||||
label: m["convert.settings.image.transparency"](),
|
||||
type: "boolean",
|
||||
default: true,
|
||||
disabled: fromJpeg || toJpeg,
|
||||
};
|
||||
|
||||
const metadata: SettingDefinition = {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export interface SettingDefinition {
|
|||
key: string;
|
||||
label: string;
|
||||
type: SettingType;
|
||||
disabled?: boolean;
|
||||
default?: any;
|
||||
placeholder?: any;
|
||||
min?: number;
|
||||
|
|
|
|||
Loading…
Reference in New Issue