修复 bug

This commit is contained in:
eafonyang
2026-06-12 15:58:08 +08:00
parent 56a76e68ef
commit 1b0b447eee
10 changed files with 135 additions and 20 deletions
@@ -15,6 +15,8 @@ export function CyanSlider({
max,
step = 1,
onChange,
onInteractionStart,
onInteractionEnd,
disabled = false,
}: {
value: number;
@@ -22,6 +24,8 @@ export function CyanSlider({
max: number;
step?: number;
onChange: (v: number) => void;
onInteractionStart?: () => void;
onInteractionEnd?: () => void;
disabled?: boolean;
}) {
const fillPct = Math.max(0, Math.min(100, ((value - min) / (max - min)) * 100));
@@ -43,8 +47,12 @@ export function CyanSlider({
value={value}
className="cyan-slider relative z-10"
disabled={disabled}
onPointerDown={() => onInteractionStart?.()}
onFocus={() => onInteractionStart?.()}
onPointerUp={() => onInteractionEnd?.()}
onPointerCancel={() => onInteractionEnd?.()}
onBlur={() => onInteractionEnd?.()}
onChange={(e) => onChange(Number(e.target.value))}
onInput={(e) => onChange(Number(e.currentTarget.value))}
/>
</div>
);
+3
View File
@@ -11,6 +11,9 @@ export const BAND_GAIN_MAX = 15;
export const BAND_Q_MIN = 0.1;
export const BAND_Q_MAX = 10;
/** Maximum headphone PEQ presets stored on device. */
export const PEQ_PRESET_MAX = 50;
export const BAND_PARAM_VALUE_BOX_STYLE: CSSProperties = {
background: "rgba(44,44,46,0.9)",
border: "1px solid rgba(255,255,255,0.08)",
+15
View File
@@ -6,6 +6,21 @@ export function cloneBands(source: EqBand[]) {
return source.map((band) => ({ ...band }));
}
/** Dev: log decoded syncPeq JSON after EQ page fetches device PEQ state. */
export function logEqSyncPeqDev(source: string, data: PeqState): void {
if (!import.meta.env.DEV) return;
console.log(`[EQ syncPeq] ${source}`, data);
}
export async function fetchEqSyncPeq(
api: { getPeqState: () => Promise<PeqState> },
source: string,
): Promise<PeqState> {
const data = await api.getPeqState();
logEqSyncPeqDev(source, data);
return data;
}
export function buildPeqCatalogSyncKey(
remote: Pick<PeqState, "peq" | "peqSelect"> | null | undefined,
devicePeqSelect?: number,