Refactor LuxsinAPI to correct firmware version comparison in boot sound settings; enhance useStrokeDrawAnimation hook to support path updates without replaying animation. Update EQPage to utilize new animation options for smoother transitions during EQ parameter edits.

This commit is contained in:
yangy
2026-05-18 17:21:00 +08:00
parent ba5f5d074a
commit edd677c79d
3 changed files with 28 additions and 12 deletions
+10 -8
View File
@@ -274,18 +274,19 @@ function FreqChart({
const hasRawCurve = !!rawPathD;
const hasEqualizedCurve = !!equalizedPathD;
// Reusable left-to-right stroke draw animation (skip while dragging a band).
// Intro draw once; EQ param edits update path in place without replaying the stroke animation.
const strokeAnimOpts = { durationMs: 1350, replayOnPathChange: false as const };
useStrokeDrawAnimation(curvePathRef, pathD, {
...strokeAnimOpts,
enabled: !isBandDragging,
durationMs: 1350,
});
useStrokeDrawAnimation(rawPathRef, rawPathD, {
...strokeAnimOpts,
enabled: !isBandDragging && !!rawPathD,
durationMs: 1350,
});
useStrokeDrawAnimation(equalizedPathRef, equalizedPathD, {
...strokeAnimOpts,
enabled: !isBandDragging && !!equalizedPathD,
durationMs: 1350,
});
const targetMode: "A" | "B" = abMode === "A" ? "B" : "A";
@@ -1153,6 +1154,11 @@ export default function EQPage() {
}
}, [deviceState?.peqSelect]);
// 切换耳机时默认回到 A 组对比
useEffect(() => {
setAbMode("A");
}, [headphoneIdx]);
// 获取耳机原始曲线
const getModelCurve = async (brand: string, name: string) => {
try {
@@ -1541,10 +1547,6 @@ export default function EQPage() {
const updateBand = (idx: number, patch: Partial<typeof bands[0]>) => {
const nextBands = bands.map((b, i) => (i === idx ? { ...b, ...patch } : b));
setBands(nextBands);
// Re-render chart when band changes
if (peqItems.length > 0 && headphoneIdx < peqItems.length) {
renderCharts(nextBands, currentRawCurve, false);
}
};
const updateCurrentPeqMeta = (patch: Partial<{ autoPre: number; preamp: number }>) => {