calendar: delay zoom-in content switch until end of morph
This commit is contained in:
@@ -2287,6 +2287,12 @@ function waitCalendarZoom() {
|
||||
});
|
||||
}
|
||||
|
||||
function waitMs(ms: number) {
|
||||
return new Promise<void>((resolve) => {
|
||||
setTimeout(() => resolve(), ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function animateCalendarZoomIn(sourceElement: HTMLElement | null, apply: () => void) {
|
||||
const fromRect = getElementRectInCalendar(sourceElement);
|
||||
const viewportRect = getCalendarViewportRect();
|
||||
@@ -2299,12 +2305,13 @@ async function animateCalendarZoomIn(sourceElement: HTMLElement | null, apply: (
|
||||
calendarZoomBusy.value = true;
|
||||
try {
|
||||
primeCalendarRect(fromRect);
|
||||
morphCalendarRect(viewportRect);
|
||||
const switchLag = 260;
|
||||
await waitMs(Math.max(0, CALENDAR_ZOOM_DURATION_MS - switchLag));
|
||||
calendarSceneMasked.value = true;
|
||||
await nextTick();
|
||||
apply();
|
||||
await nextTick();
|
||||
morphCalendarRect(viewportRect);
|
||||
await waitCalendarZoom();
|
||||
await waitMs(switchLag);
|
||||
} finally {
|
||||
calendarSceneMasked.value = false;
|
||||
calendarZoomBusy.value = false;
|
||||
|
||||
Reference in New Issue
Block a user