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