修复&优化听力补偿模块功能
This commit is contained in:
@@ -41,6 +41,7 @@ const iisModeImageUrl = (index: number) =>
|
||||
const KEY_TO_SETTING: Record<string, string> = {
|
||||
effect_value: "effect_value",
|
||||
crossfeed_value: "crossfeed_value",
|
||||
hearing_select: "hearing_select",
|
||||
language: "language",
|
||||
analogGain: "analogGain",
|
||||
soundStep: "soundStep",
|
||||
@@ -82,8 +83,21 @@ export function consumeSelectPageResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Scroll position of the calling page, captured before navigating to /select.
|
||||
// The select page is short, so the browser clamps window scroll to 0 while on
|
||||
// it; without restoring, the calling page (e.g. Effects) reopens at the top.
|
||||
let selectReturnScroll: number | null = null;
|
||||
|
||||
/** Consume the stored scroll position (once). Returns null when absent. */
|
||||
export function consumeSelectReturnScroll(): number | null {
|
||||
const y = selectReturnScroll;
|
||||
selectReturnScroll = null;
|
||||
return y;
|
||||
}
|
||||
|
||||
// Helper function to set select page state
|
||||
export function navigateToSelect(title: string, options: string[], selected: number, back: string, key: string) {
|
||||
selectReturnScroll = window.scrollY;
|
||||
selectPageState = { title, options, selected, back, key };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user