calendar: make zoom-out use the same camera panzoom pipeline
This commit is contained in:
@@ -2702,33 +2702,43 @@ async function animateCalendarZoomIn(sourceElement: HTMLElement | null, ghost: C
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function animateCalendarZoomOut(apply: () => void, resolveTarget: () => HTMLElement | null) {
|
async function animateCalendarZoomOut(apply: () => void, resolveTarget: () => HTMLElement | null) {
|
||||||
const viewportRect = getCalendarViewportRect();
|
|
||||||
if (!viewportRect) {
|
|
||||||
apply();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clearCalendarZoomPrime();
|
clearCalendarZoomPrime();
|
||||||
calendarZoomBusy.value = true;
|
calendarZoomBusy.value = true;
|
||||||
|
clearCalendarZoomOverlay();
|
||||||
try {
|
try {
|
||||||
primeCalendarRect(viewportRect);
|
|
||||||
calendarZoomGhost.value = zoomGhostForCurrentView();
|
calendarZoomGhost.value = zoomGhostForCurrentView();
|
||||||
calendarSceneMasked.value = true;
|
calendarSceneMasked.value = true;
|
||||||
await flushCalendarZoomStartFrame();
|
|
||||||
apply();
|
apply();
|
||||||
await nextTick();
|
await nextTick();
|
||||||
const targetRect = getElementRectInCalendar(resolveTarget());
|
const targetRect = getElementRectInScene(resolveTarget()) ?? fallbackZoomOriginRectInScene();
|
||||||
if (!targetRect) {
|
const cameraStart = targetRect ? cameraTransformForRect(targetRect) : null;
|
||||||
calendarZoomOverlay.value = {
|
if (!cameraStart) {
|
||||||
...calendarZoomOverlay.value,
|
calendarSceneMasked.value = false;
|
||||||
active: false,
|
|
||||||
};
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
morphCalendarRect(targetRect);
|
calendarCameraState.value = {
|
||||||
await waitCalendarZoomTransition();
|
active: true,
|
||||||
|
left: cameraStart.left,
|
||||||
|
top: cameraStart.top,
|
||||||
|
scale: cameraStart.scale,
|
||||||
|
durationMs: 0,
|
||||||
|
};
|
||||||
|
await nextTick();
|
||||||
|
await nextAnimationFrame();
|
||||||
|
calendarSceneRef.value?.getBoundingClientRect();
|
||||||
|
calendarSceneMasked.value = false;
|
||||||
|
await nextAnimationFrame();
|
||||||
|
calendarCameraState.value = {
|
||||||
|
active: true,
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
scale: 1,
|
||||||
|
durationMs: CALENDAR_ZOOM_DURATION_MS,
|
||||||
|
};
|
||||||
|
await waitCalendarCameraTransition();
|
||||||
} finally {
|
} finally {
|
||||||
clearCalendarZoomOverlay();
|
await resetCalendarCamera();
|
||||||
|
calendarZoomGhost.value = null;
|
||||||
calendarSceneMasked.value = false;
|
calendarSceneMasked.value = false;
|
||||||
calendarZoomBusy.value = false;
|
calendarZoomBusy.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user