1+ /* eslint-disable max-len */
2+ /* eslint-disable @typescript-eslint/ban-types */
3+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
4+ /* eslint-disable @typescript-eslint/no-explicit-any */
5+ /* eslint-disable @typescript-eslint/no-unused-vars */
16/* eslint-disable no-use-before-define */
27/* eslint-disable react/no-this-in-sfc */
38/* eslint-disable no-unused-vars */
@@ -23,15 +28,15 @@ import { schemeSet1 as colorScheme } from 'd3';
2328// import { addNewSnapshots } from '../actions/actions.ts';
2429
2530interface PerfViewProps {
26- snapshots :any [ ] ;
27- viewIndex :number ;
31+ snapshots :any [ ] ;
32+ viewIndex :number ;
2833 width : number ;
2934 height : number ;
3035}
3136
3237const PerfView = ( props :PerfViewProps ) => {
33- const { snapshots, viewIndex, width, height } = props
34- let adjustedSize = Math . min ( width , height ) ;
38+ const { snapshots, viewIndex, width, height } = props ;
39+ const adjustedSize = Math . min ( width , height ) ;
3540 const svgRef = useRef ( null ) ;
3641
3742 // Figure out which snapshot index to use
@@ -79,7 +84,7 @@ const PerfView = (props:PerfViewProps) => {
7984 let view ;
8085
8186 // Set up viewBox dimensions and onClick for parent svg
82-
87+
8388 // console.log("PerfView -> height", height)
8489 // console.log("PerfView -> width", width)
8590 // console.log("PerfView -> adjustedSize", adjustedSize)
@@ -107,7 +112,8 @@ const PerfView = (props:PerfViewProps) => {
107112 . style ( 'fill-opacity' , ( d :{ parent :object } ) => ( d . parent === packedRoot ? 1 : 0 ) )
108113 . style ( 'display' , ( d :{ parent ?:object } ) => ( d . parent === packedRoot ? 'inline' : 'none' ) )
109114 . text ( ( d :{ data :{ name :string , componentData ?:{ actualDuration :any } } } ) => {
110- return `${ d . data . name } : ${ Number . parseFloat ( d . data . componentData . actualDuration || 0 ) . toFixed ( 2 ) } ms` } ) ;
115+ return `${ d . data . name } : ${ Number . parseFloat ( d . data . componentData . actualDuration || 0 ) . toFixed ( 2 ) } ms` ;
116+ } ) ;
111117
112118 // Remove any unused nodes
113119 label . exit ( ) . remove ( ) ;
@@ -129,7 +135,7 @@ const PerfView = (props:PerfViewProps) => {
129135 function zoomToNode ( newFocus :{ x :number ; y :number ; r :number } ) {
130136 const transition = svg . transition ( )
131137 . duration ( d3 . event . altKey ? 7500 : 750 )
132- . tween ( 'zoom' , ( d :object ) => {
138+ . tween ( 'zoom' , ( d :object ) => {
133139 const i = d3 . interpolateZoom ( view , [ newFocus . x , newFocus . y , newFocus . r * 2 ] ) ;
134140 return t => zoomViewArea ( i ( t ) ) ;
135141 } ) ;
@@ -144,7 +150,7 @@ const PerfView = (props:PerfViewProps) => {
144150
145151 curFocus = newFocus ;
146152 }
147- } , [ colorScale , packFunc , width , height , indexToDisplay , snapshots ] ) ;
153+ } , [ colorScale , packFunc , width , height , indexToDisplay , snapshots , adjustedSize ] ) ;
148154
149155 return (
150156 < div className = "perf-d3-container" >
@@ -156,6 +162,5 @@ const PerfView = (props:PerfViewProps) => {
156162
157163export default PerfView ;
158164
159-
160165 // d3.quantize(d3.interpolateHcl('#60c96e', '#4d4193'), 10);
161166 // const colorScale = d3.scaleOrdinal(colorScheme);
0 commit comments