mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 07:16:02 +00:00
refactor: remove redundant quick background toggle
This commit is contained in:
@@ -266,10 +266,6 @@ export function SettingsPanel({
|
||||
const [customImages, setCustomImages] = useState<string[]>(
|
||||
initialEditorPreferences.customWallpapers,
|
||||
);
|
||||
const removeBackgroundStateRef = useRef<{
|
||||
aspectRatio: AspectRatio;
|
||||
padding: number;
|
||||
} | null>(null);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -315,7 +311,6 @@ export function SettingsPanel({
|
||||
const [gradient, setGradient] = useState<string>(
|
||||
GRADIENTS.includes(selected) ? selected : GRADIENTS[0],
|
||||
);
|
||||
const removeBackgroundEnabled = aspectRatio === "native" && padding === 0;
|
||||
const [backgroundTab, setBackgroundTab] = useState<BackgroundTab>(() =>
|
||||
getBackgroundTabForWallpaper(selected),
|
||||
);
|
||||
@@ -342,24 +337,6 @@ export function SettingsPanel({
|
||||
saveEditorPreferences({ customWallpapers: customImages });
|
||||
}, [customImages]);
|
||||
|
||||
const handleRemoveBackgroundToggle = (checked: boolean) => {
|
||||
if (checked) {
|
||||
removeBackgroundStateRef.current = {
|
||||
aspectRatio,
|
||||
padding,
|
||||
};
|
||||
onAspectRatioChange?.("native");
|
||||
onPaddingChange?.(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (removeBackgroundStateRef.current) {
|
||||
onAspectRatioChange?.(removeBackgroundStateRef.current.aspectRatio);
|
||||
onPaddingChange?.(removeBackgroundStateRef.current.padding);
|
||||
removeBackgroundStateRef.current = null;
|
||||
}
|
||||
};
|
||||
|
||||
const webcamFileName = webcam?.sourcePath?.split(/[\\/]/).pop() ?? null;
|
||||
|
||||
const zoomEnabled = Boolean(selectedZoomDepth);
|
||||
@@ -884,14 +861,6 @@ export function SettingsPanel({
|
||||
parseInput={(t) => parseFloat(t.replace(/%$/, ""))}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2 flex items-center justify-between p-2 rounded-lg bg-white/5 border border-white/5">
|
||||
<div className="text-[10px] font-medium text-slate-300">{tSettings("effects.removeBackground")}</div>
|
||||
<Switch
|
||||
checked={removeBackgroundEnabled}
|
||||
onCheckedChange={handleRemoveBackgroundToggle}
|
||||
className="data-[state=checked]:bg-[#2563EB] scale-90"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
"webcamShadow": "Webcam Shadow",
|
||||
"shadow": "Shadow",
|
||||
"roundness": "Roundness",
|
||||
"padding": "Padding",
|
||||
"removeBackground": "Remove background"
|
||||
"padding": "Padding"
|
||||
},
|
||||
"crop": {
|
||||
"title": "Crop Video",
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
"webcamShadow": "Sombra de cámara",
|
||||
"shadow": "Sombra",
|
||||
"roundness": "Redondez",
|
||||
"padding": "Relleno",
|
||||
"removeBackground": "Quitar fondo"
|
||||
"padding": "Relleno"
|
||||
},
|
||||
"crop": {
|
||||
"title": "Recortar video",
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
"webcamShadow": "摄像头阴影",
|
||||
"shadow": "阴影",
|
||||
"roundness": "圆角",
|
||||
"padding": "内边距",
|
||||
"removeBackground": "移除背景"
|
||||
"padding": "内边距"
|
||||
},
|
||||
"crop": {
|
||||
"title": "裁剪视频",
|
||||
|
||||
Reference in New Issue
Block a user