File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 71
71
"meshline" : " ^3.1.6" ,
72
72
"react-composer" : " ^5.0.3" ,
73
73
"react-merge-refs" : " ^1.1.0" ,
74
- "stats-gl" : " ^1 .0.4 " ,
74
+ "stats-gl" : " ^2 .0.0 " ,
75
75
"stats.js" : " ^0.17.0" ,
76
76
"suspend-react" : " ^0.1.3" ,
77
77
"three-mesh-bvh" : " ^0.6.7" ,
Original file line number Diff line number Diff line change 1
1
import * as React from 'react'
2
- import { addEffect , addAfterEffect , useThree } from '@react-three/fiber'
2
+ import { addAfterEffect , useThree } from '@react-three/fiber'
3
3
import Stats from 'stats-gl'
4
4
5
5
type Props = Partial < Stats > & {
@@ -9,26 +9,24 @@ type Props = Partial<Stats> & {
9
9
}
10
10
11
11
export function StatsGl ( { className, parent, ...props } : Props ) {
12
- const gl = useThree ( ( state ) => state . gl )
12
+ const gl : any = useThree ( ( state ) => state . gl )
13
13
14
14
const stats = React . useMemo ( ( ) => {
15
15
const stats = new Stats ( {
16
16
...props ,
17
17
} )
18
- stats . init ( gl . domElement )
18
+ stats . init ( gl )
19
19
return stats
20
20
} , [ gl ] )
21
21
22
22
React . useEffect ( ( ) => {
23
23
if ( stats ) {
24
24
const node = ( parent && parent . current ) || document . body
25
- node ?. appendChild ( stats . container )
25
+ node ?. appendChild ( stats . dom )
26
26
if ( className ) stats . container . classList . add ( ...className . split ( ' ' ) . filter ( ( cls ) => cls ) )
27
- const begin = addEffect ( ( ) => stats . begin ( ) )
28
- const end = addAfterEffect ( ( ) => stats . end ( ) )
27
+ const end = addAfterEffect ( ( ) => stats . update ( ) )
29
28
return ( ) => {
30
- node ?. removeChild ( stats . container )
31
- begin ( )
29
+ node ?. removeChild ( stats . dom )
32
30
end ( )
33
31
}
34
32
}
Original file line number Diff line number Diff line change @@ -12635,10 +12635,10 @@ static-extend@^0.1.1:
12635
12635
define-property "^0.2.5"
12636
12636
object-copy "^0.1.0"
12637
12637
12638
- stats-gl@^1 .0.4 :
12639
- version "1 .0.5 "
12640
- resolved "https://registry.yarnpkg.com/stats-gl/-/stats-gl-1 .0.5 .tgz#7f2b6688cc37b3d4bc79749ab122c063528be9c3 "
12641
- integrity sha512-XimMxvwnf1Qf5KwebhcoA34kcX+fWEkIl0QjNkCbu4IpoyDMMsOajExn7FIq5w569k45+LhmsuRlGSrsvmGdNw ==
12638
+ stats-gl@^2 .0.0 :
12639
+ version "2 .0.0 "
12640
+ resolved "https://registry.yarnpkg.com/stats-gl/-/stats-gl-2 .0.0 .tgz#50788125495b54762fd0a0dabe6fdcb12cee73b1 "
12641
+ integrity sha512-fDUcbOmcdTJspBBw8BAXXICSpQbL4nbfBdYCWHWoimnfguHmIH3xH+HBCJBjewDOy2EzTJYw3e5fnbALIKTiQA ==
12642
12642
12643
12643
stats.js@^0.17.0:
12644
12644
version "0.17.0"
You can’t perform that action at this time.
0 commit comments