Smooth calendar resize during panel transitions
Replace single delayed updateSize() with requestAnimationFrame loop that continuously resizes FullCalendar throughout the 300ms CSS transition, eliminating the visual desync between panel and calendar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8945295e2a
commit
057b43627b
@ -90,12 +90,19 @@ export default function CalendarPage() {
|
||||
|
||||
const panelOpen = panelMode !== 'closed';
|
||||
|
||||
// Resize calendar when panel opens/closes (CSS transition won't trigger ResizeObserver on inner div)
|
||||
// Continuously resize calendar during panel open/close CSS transition
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
let rafId: number;
|
||||
const start = performance.now();
|
||||
const duration = 350; // slightly longer than the 300ms CSS transition
|
||||
const tick = () => {
|
||||
calendarRef.current?.getApi().updateSize();
|
||||
}, 320);
|
||||
return () => clearTimeout(timeout);
|
||||
if (performance.now() - start < duration) {
|
||||
rafId = requestAnimationFrame(tick);
|
||||
}
|
||||
};
|
||||
rafId = requestAnimationFrame(tick);
|
||||
return () => cancelAnimationFrame(rafId);
|
||||
}, [panelOpen]);
|
||||
|
||||
// Scroll wheel navigation in month view
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user