新增 undo 功能

This commit is contained in:
eafonyang
2026-08-14 16:40:47 +08:00
parent 4a67622d9b
commit 8ca8128e2b
4 changed files with 23 additions and 20 deletions
@@ -7,6 +7,7 @@ import {
} from "@/lib/peqAudio";
import type { PeqEqUi } from "../constants";
import { eqInterp } from "../utils";
import { PeqUndoButton } from "./PeqUndoButton";
/* ── Legend indicator ── */
function LegendCurveIndicator({
@@ -37,6 +38,8 @@ export function FreqChart({
abMode,
onAbToggle,
onCopyAndSwitchTo,
canUndo,
onUndo,
onApplyB,
onSaveB,
onBandDrag,
@@ -52,6 +55,8 @@ export function FreqChart({
abMode: "A" | "B";
onAbToggle: (m: "A" | "B") => void;
onCopyAndSwitchTo: (to: "A" | "B") => void;
canUndo: boolean;
onUndo: () => void;
onApplyB: () => void;
onSaveB: () => void;
onBandDrag: (idx: number, patch: Partial<{ freq: number; gain: number }>) => void;
@@ -295,6 +300,11 @@ export function FreqChart({
}}>
{copyButtonText}
</button>
<PeqUndoButton
disabled={!canUndo}
label={eqUi.undo ?? "Undo"}
onClick={onUndo}
/>
</div>
<div className="ml-auto flex shrink-0 items-center gap-2">
<button