mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
close effects after last effect removal + spacing
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import type { Effect } from "@/types/effects";
|
import type { Effect } from "@/types/effects";
|
||||||
import type { VisualElement } from "@/types/timeline";
|
import type { VisualElement } from "@/types/timeline";
|
||||||
import { getEffect } from "@/lib/effects/registry";
|
import { getEffect } from "@/lib/effects/registry";
|
||||||
@@ -37,6 +37,10 @@ export function ClipEffectsProperties({
|
|||||||
const editor = useEditor();
|
const editor = useEditor();
|
||||||
const effects = element.effects ?? [];
|
const effects = element.effects ?? [];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (effects.length === 0) closeClipEffects();
|
||||||
|
}, [effects.length, closeClipEffects]);
|
||||||
|
|
||||||
const [dragIndex, setDragIndex] = useState<number | null>(null);
|
const [dragIndex, setDragIndex] = useState<number | null>(null);
|
||||||
const [dropIndex, setDropIndex] = useState<number | null>(null);
|
const [dropIndex, setDropIndex] = useState<number | null>(null);
|
||||||
|
|
||||||
@@ -163,7 +167,7 @@ function ClipEffectSection({
|
|||||||
<SectionHeader
|
<SectionHeader
|
||||||
className="cursor-move"
|
className="cursor-move"
|
||||||
trailing={
|
trailing={
|
||||||
<>
|
<div className="flex items-center gap-1">
|
||||||
<Button
|
<Button
|
||||||
variant={effect.enabled ? "secondary" : "ghost"}
|
variant={effect.enabled ? "secondary" : "ghost"}
|
||||||
size="icon"
|
size="icon"
|
||||||
@@ -182,7 +186,7 @@ function ClipEffectSection({
|
|||||||
>
|
>
|
||||||
<HugeiconsIcon icon={Delete02Icon} />
|
<HugeiconsIcon icon={Delete02Icon} />
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<SectionTitle
|
<SectionTitle
|
||||||
|
|||||||
Reference in New Issue
Block a user