mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-08 11:13:32 +02:00
fix: use requestAnimationFrame for smooth sidebar scroll tracking
This commit is contained in:
parent
37afd14208
commit
b3063c75da
@ -165,8 +165,15 @@ function initSidebarToggle(elFileView: HTMLElement): void {
|
||||
});
|
||||
resizeObserver.observe(document.body);
|
||||
|
||||
// Update position on scroll
|
||||
window.addEventListener('scroll', updatePosition, {passive: true});
|
||||
// Update position on scroll - use requestAnimationFrame for smooth updates
|
||||
let scrollRafId: number | null = null;
|
||||
window.addEventListener('scroll', () => {
|
||||
if (scrollRafId !== null) return; // Already scheduled
|
||||
scrollRafId = requestAnimationFrame(() => {
|
||||
updatePosition();
|
||||
scrollRafId = null;
|
||||
});
|
||||
}, {passive: true});
|
||||
|
||||
toggleBtn.addEventListener('click', () => {
|
||||
const isCurrentlyVisible = !sidebar.classList.contains('sidebar-panel-hidden');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user