fix: 详情页滚动与多余背景 — 对齐原站路由级 canvas 生命周期

- HeroScene/LoadingOverlay 仅在 "/" 渲染(原 canvas/set:详情页 reveal 后
  卸载 canvas;entry 幕布是主页专属流程)——详情页不再有贴纸/背景 FX/玻璃
  模型等"多余背景",也没有 loading 幕布
- 详情页滚动容器改为常规文档流:我们的 Lenis 是 window 级,原版的嵌套
  overflow-y-auto 容器会吞掉滚轮导致页面不能滚动;窗口原生滚动接管
- SmoothScroller 按路由启停 Lenis(原 95212:主页 ReactLenis、详情页原生
  滚动),路由切换时滚动复位到顶部(转场遮罩盖住跳变)
- CDP 实测:详情页 wheel/End 滚动 ✅、canvas=0、幕布=0;返回主页后
  canvas/Lenis/滚动条恢复、wheel 平滑滚动 ✅
This commit is contained in:
2026-09-01 20:57:50 +08:00
parent 13e2a7a674
commit e4ee38175e
4 changed files with 60 additions and 24 deletions
+10
View File
@@ -1,6 +1,7 @@
"use client";
import { useEffect, useRef } from "react";
import { usePathname } from "next/navigation";
import { Canvas, useThree } from "@react-three/fiber";
import { PerspectiveCamera } from "@react-three/drei";
@@ -76,6 +77,13 @@ export function HeroScene() {
const isMobile = useIsMobile();
const ready = useAppReady();
const hostRef = useRef<HTMLDivElement>(null);
// Original canvas lifecycle (module 34841 `canvas/set`): the canvas is
// mounted for the home page and the fullscreen transitions; on detail
// routes it is unmounted once the route reveal completes. Our DOM-based
// transition overlay covers navigation, so the canvas simply renders
// home-only — no background FX / stickers / models leak onto detail pages.
const pathname = usePathname();
const home = pathname === "/";
// Watchdog (outside the Canvas so it runs even before R3F configures):
// R3F's react-use-measure can capture a stale intrinsic-size measurement
@@ -111,6 +119,8 @@ export function HeroScene() {
};
}, []);
if (!home) return null;
return (
// 1:1 original stacking: z-auto fixed host BEFORE the grid/main in DOM.
// The z-20 BackgroundGrid (rendered after this element) paints above the