11import { type Fiber } from 'react-reconciler' ;
2- import { throttle } from './helpers' ;
3- import { LRUMap } from './lru' ;
4- import { type DrawingQueue , outlineWorker } from './outline-worker' ;
52import { ReactScanInternals , type OutlineKey } from '~core/index' ;
63import { type AggregatedChange } from '~core/instrumentation' ;
74import { getLabelText , joinAggregations } from '~core/utils' ;
5+ import { throttle } from './helpers' ;
6+ import { LRUMap } from './lru' ;
7+ import { outlineWorker , type DrawingQueue } from './outline-worker' ;
88
99const enum Reason {
1010 Commit = 0b001 ,
@@ -162,7 +162,7 @@ export const fadeOutOutline = () => {
162162 const averageScore = Math . max (
163163 ( THRESHOLD_FPS - Math . min ( avgFps , THRESHOLD_FPS ) ) / THRESHOLD_FPS ,
164164 invariantActiveOutline . aggregatedRender . time ??
165- 0 / invariantActiveOutline . aggregatedRender . aggregatedCount / 16 ,
165+ 0 / invariantActiveOutline . aggregatedRender . aggregatedCount / 16 ,
166166 ) ;
167167
168168 const t = Math . min ( averageScore , 1 ) ;
@@ -641,7 +641,7 @@ function mergeTwoLabels(
641641 return {
642642 alpha : Math . max ( a . alpha , b . alpha ) ,
643643
644- ... pickColorClosestToStartStage ( a , b ) , // kinda wrong, should pick color in earliest stage
644+ color : pickColorClosestToStartStage ( a , b ) , // kinda wrong, should pick color in earliest stage
645645 reasons : mergedReasons ,
646646 groupedAggregatedRender : mergedGrouped ,
647647 rect : mergedRect ,
@@ -656,19 +656,25 @@ function getBoundingRect(r1: DOMRect, r2: DOMRect): DOMRect {
656656 return new DOMRect ( x1 , y1 , x2 - x1 , y2 - y1 ) ;
657657}
658658
659+ interface Color {
660+ r : number ;
661+ g : number ;
662+ b : number ;
663+ }
664+
659665function pickColorClosestToStartStage (
660666 a : MergedOutlineLabel ,
661667 b : MergedOutlineLabel ,
662- ) {
668+ ) : Color {
663669 // stupid hack to always take the gray value when the render is unnecessary (we know the gray value has equal rgb)
664670 if ( a . color . r === a . color . g && a . color . g === a . color . b ) {
665- return { color : a . color } ;
671+ return a . color ;
666672 }
667673 if ( b . color . r === b . color . g && b . color . g === b . color . b ) {
668- return { color : b . color } ;
674+ return b . color ;
669675 }
670676
671- return { color : a . color . r <= b . color . r ? a . color : b . color } ;
677+ return a . color . r <= b . color . r ? a . color : b . color ;
672678}
673679
674680function getOverlapArea ( rect1 : DOMRect , rect2 : DOMRect ) : number {
0 commit comments