新增 undo 功能

This commit is contained in:
eafonyang
2026-08-14 16:40:45 +08:00
parent 546c8eb970
commit 907c474e28
4 changed files with 28 additions and 27 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