refactor: extract magic constants — wave 4 (UX timings + physics)
Name throttle/debounce intervals, spring presets, and layout paddings
that were inline numeric literals:
- VirtualList: VISIBLE_CHANGE_THROTTLE_MS (150), NEAR_BOTTOM_THROTTLE_MS
(200), JUMP_THROTTLE_MS (200)
- SampleList: CHECK_POSITION_THROTTLE_MS (100)
- SliderArea: SLIDER_SPRING_CONFIG ({stiffness: 0.2, damping: 0.7}),
SLIDER_PERSIST_DEBOUNCE_MS (100), SLIDER_PADDING_MOBILE_PX (48),
SLIDER_PADDING_DESKTOP_PX (96)
- FontVirtualList: TOUCH_DEBOUNCE_MS (150)
- createPerspectiveManager: PERSPECTIVE_SPRING_CONFIG ({stiffness: 0.2,
damping: 0.8})
No behavior changes — values preserved exactly.
This commit is contained in:
@@ -83,9 +83,15 @@ async function handleJump(targetIndex: number) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Debounce wait before asking the font lifecycle manager to load fonts
|
||||
* for the current visible window. Coalesces rapid scroll into one batch.
|
||||
*/
|
||||
const TOUCH_DEBOUNCE_MS = 150;
|
||||
|
||||
const debouncedTouch = debounce((configs: FontLoadRequestConfig[]) => {
|
||||
fontLifecycleManager.touch(configs);
|
||||
}, 150);
|
||||
}, TOUCH_DEBOUNCE_MS);
|
||||
|
||||
// Re-touch whenever visible set or weight changes — fixes weight-change gap
|
||||
$effect(() => {
|
||||
|
||||
Reference in New Issue
Block a user