Skip to content

Commit 168df42

Browse files
committed
fix(3d): canvas 层级提至 z-0,修复概览模式点击被根布局 div 拦截
复现(elementFromPoint)确认:canvas 容器原为 z-index:-10,落在 AppLayout 根 div(z-auto、h-screen 铺满全屏、pointer-events:auto)之后;概览模式点击行星时,命中检测返回的是 transparent 的根 div 而非 canvas,根 div 无点击处理器→点击无响应(内测'点击仍无响应'真因)。修复:canvas 容器改为 z-0,位于根 div 空白区之上可接收点击,同时仍低于所有 UI 浮层(标题栏 z-50 / FunctionalOverlay z-10 / 首页按钮 z-20 / 引导 z-40+ / Radix 弹窗走 portal)。修复后 elementFromPoint 在行星位置返回 CANVAS。
1 parent 09bd954 commit 168df42

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎client/src/lib/3d/core/SceneProvider.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/**
22
* 3D场景全局提供器 — React Three Fiber Canvas容器
3-
* 作为全屏背景层,z-index: -1
3+
* 作为全屏背景层:z-0 使其位于根布局 div(z-auto)之上、可接收点击,
4+
* 但仍低于所有 UI 浮层(标题栏 z-50 / FunctionalOverlay z-10 / 引导 z-40+)。
5+
* 注意:不能用负 z-index,否则会落到根 div 之后被其透明盒拦截点击。
46
*
57
* @ai-context: 3D 场景核心(R3F):SceneProvider。
68
*/
@@ -21,7 +23,7 @@ interface SceneProviderProps {
2123

2224
export function SceneProvider({ children, interactive = false }: SceneProviderProps) {
2325
return (
24-
<div className="fixed inset-0 -z-10" style={{ pointerEvents: interactive ? 'auto' : 'none' }}>
26+
<div className="fixed inset-0 z-0" style={{ pointerEvents: interactive ? 'auto' : 'none' }}>
2527
<Canvas
2628
gl={{
2729
antialias: true,

0 commit comments

Comments
 (0)