Skip to content

Commit c4162cb

Browse files
author
shijiashuai
committed
refactor(DigitalHumanViewer): optimize imports and remove unused state
- Remove unused React import from component - Simplify VisibilityOptimizer component by removing unused autoRotate prop parameter - Remove unnecessary useRef hooks (wasAutoRotateRef, controlsRef) that were not utilized - Clean up component interface to reduce prop drilling and improve maintainability - Streamline visibility optimization logic for better code clarity
1 parent 195f0e4 commit c4162cb

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/components/DigitalHumanViewer.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useRef, useState, useCallback } from 'react';
1+
import { useEffect, useRef, useState, useCallback } from 'react';
22
import { Canvas, useFrame, useThree } from '@react-three/fiber';
33
import { OrbitControls, PerspectiveCamera, Environment, Float, Sparkles, ContactShadows, Html } from '@react-three/drei';
44
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
@@ -40,15 +40,12 @@ function FPSMonitor({ onFPSUpdate }: { onFPSUpdate?: (fps: number) => void }) {
4040

4141
// 页面可见性优化组件
4242
function VisibilityOptimizer({
43-
autoRotate,
4443
onVisibilityChange
4544
}: {
4645
autoRotate: boolean;
4746
onVisibilityChange?: (visible: boolean) => void;
4847
}) {
4948
const { gl } = useThree();
50-
const wasAutoRotateRef = useRef(autoRotate);
51-
const controlsRef = useRef<any>(null);
5249

5350
useEffect(() => {
5451
const handleVisibilityChange = () => {

0 commit comments

Comments
 (0)