This commit is contained in:
CN-JS-HuiBai
2026-04-06 02:34:27 +08:00
parent 90b31f9926
commit d0bc646c22

View File

@@ -243,7 +243,8 @@
dom.globeCard.offsetHeight; // Force reflow
dom.globeCard.style.transition = 'transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease';
dom.globeCard.style.transform = '';
// Use explicit values instead of empty string for better transition reliability
dom.globeCard.style.transform = 'translate(0px, 0px) scale(1)';
dom.globeCard.style.boxShadow = '';
const onTransitionEnd = (e) => {
@@ -291,14 +292,16 @@
const dx = (savedGlobeRect.left + savedGlobeRect.width / 2) - (expandedRect.left + expandedRect.width / 2);
const dy = (savedGlobeRect.top + savedGlobeRect.height / 2) - (expandedRect.top + expandedRect.height / 2);
// Ensure we are at a known state before starting transition
dom.globeCard.style.transform = 'translate(0px, 0px) scale(1)';
dom.globeCard.offsetHeight; // Force reflow
dom.globeCard.style.willChange = 'transform, box-shadow';
dom.globeCard.style.transition = 'transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease';
// Force change to ensure transition fires
requestAnimationFrame(() => {
dom.globeCard.style.transform = `translate(${dx}px, ${dy}px) scale(${scaleX}, ${scaleY})`;
dom.globeCard.style.boxShadow = '0 0 0 0 transparent, 0 0 0 0 transparent';
});
// Apply target values
dom.globeCard.style.transform = `translate(${dx}px, ${dy}px) scale(${scaleX}, ${scaleY})`;
dom.globeCard.style.boxShadow = '0 0 0 0 transparent, 0 0 0 0 transparent';
let transitionFinished = false;
const onTransitionEnd = (e) => {
@@ -309,7 +312,7 @@
};
dom.globeCard.addEventListener('transitionend', onTransitionEnd);
// Robustness fallback (400ms > 350ms transition)
// Robustness fallback
setTimeout(() => {
if (!transitionFinished) {
dom.globeCard.removeEventListener('transitionend', onTransitionEnd);