From 0004bffd8b2e5a91d097e48dc8050690240a59a5 Mon Sep 17 00:00:00 2001 From: yaosanqi137 Date: Fri, 4 Sep 2026 17:22:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E7=99=BD=E5=A4=A9/=E9=BB=91=E5=A4=9C=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=97=B6=E5=8A=A8=E7=94=BB=E6=92=AD=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/ITStudioMainSite/assets/js/theme-toggle.js | 15 +++++++++++++-- themes/ITStudioMainSite/functions.php | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/themes/ITStudioMainSite/assets/js/theme-toggle.js b/themes/ITStudioMainSite/assets/js/theme-toggle.js index 2400328..76c67c9 100644 --- a/themes/ITStudioMainSite/assets/js/theme-toggle.js +++ b/themes/ITStudioMainSite/assets/js/theme-toggle.js @@ -19,6 +19,14 @@ function ensureViewTransitionStyles() { mix-blend-mode: normal; } + ::view-transition-old(root) { + z-index: 0; + } + + ::view-transition-new(root) { + z-index: 1; + } + ::view-transition-group(root) { animation: none; } @@ -86,7 +94,7 @@ function getTransitionOrigin(event, toggle) { function getRevealRadius(x, y) { const maxX = Math.max(x, window.innerWidth - x); const maxY = Math.max(y, window.innerHeight - y); - return Math.hypot(maxX, maxY); + return Math.hypot(maxX, maxY) * 1.05 + 2; } function switchThemeWithScatter(theme, origin) { @@ -108,16 +116,19 @@ function switchThemeWithScatter(theme, origin) { transition.ready .then(() => { - document.documentElement.animate( + const revealAnimation = document.documentElement.animate( { clipPath: [clipFrom, clipTo], }, { duration: 650, easing: 'cubic-bezier(0.22, 1, 0.36, 1)', + fill: 'both', pseudoElement: '::view-transition-new(root)', } ); + + return revealAnimation.finished; }) .catch(() => {}) .finally(() => { diff --git a/themes/ITStudioMainSite/functions.php b/themes/ITStudioMainSite/functions.php index cddde79..067b413 100644 --- a/themes/ITStudioMainSite/functions.php +++ b/themes/ITStudioMainSite/functions.php @@ -855,7 +855,7 @@ function itstudio_enqueue_scripts() { } // Scripts - wp_enqueue_script('itstudio-theme-toggle', get_template_directory_uri() . '/assets/js/theme-toggle.js', array(), '1.0.0', true); + wp_enqueue_script('itstudio-theme-toggle', get_template_directory_uri() . '/assets/js/theme-toggle.js', array(), '1.0.1', true); wp_enqueue_script('itstudio-lang-toggle', get_template_directory_uri() . '/assets/js/lang-toggle.js', array(), '1.0.0', true); wp_enqueue_script('itstudio-main', get_template_directory_uri() . '/assets/js/main.js', array(), '1.0.0', true);