@@ -13,7 +13,7 @@ import type { PaletteDragData } from "../../dnd/types";
1313import { Stage , Layer , Group , Rect , Transformer } from "react-konva" ;
1414import type Konva from "konva" ;
1515import { useLabelStore , useCurrentObjects , currentObjects , getCurrentObjects } from "../../store/labelStore" ;
16- import { isGroup , getAllLeaves , expandSelection , selectionTargetId , findObjectById } from "../../types/Group" ;
16+ import { isGroup , getAllLeaves , expandSelection , selectionTargetId , findObjectById , type LabelObject } from "../../types/Group" ;
1717import { pxToDots , SCREEN_PX_PER_MM } from "../../lib/coordinates" ;
1818import { SNAP_OPTIONS } from "../../lib/units" ;
1919import type { Unit } from "../../lib/units" ;
@@ -26,7 +26,7 @@ import { Grid } from "./Grid";
2626import { GuideLines } from "./GuideLines" ;
2727import { Ruler , RULER_SIZE } from "./Ruler" ;
2828import { ObjectRegistry } from "../../registry" ;
29- import type { LabelObject , LeafObject } from "../../registry" ;
29+ import type { LeafObject } from "../../registry" ;
3030import { useColorScheme } from "../../lib/useColorScheme" ;
3131import { objectIdsAtPoint } from "./hitTesting" ;
3232import { useT } from "../../lib/useT" ;
@@ -131,21 +131,18 @@ export const LabelCanvas = forwardRef<LabelCanvasHandle, Props>(function LabelCa
131131 // without each consumer having to walk ancestors.
132132 const visibleLeaves = useMemo ( ( ) => {
133133 const out : LeafObject [ ] = [ ] ;
134- const walk = ( nodes : LabelObject [ ] , inheritedLocked : boolean , inheritedHidden : boolean ) => {
134+ const walk = ( nodes : LabelObject [ ] , inheritedLocked : boolean ) => {
135135 for ( const n of nodes ) {
136+ if ( n . visible === false ) continue ;
136137 const locked = inheritedLocked || ! ! n . locked ;
137- const hidden = inheritedHidden || n . visible === false ;
138- if ( hidden ) continue ;
139138 if ( isGroup ( n ) ) {
140- walk ( n . children , locked , hidden ) ;
139+ walk ( n . children , locked ) ;
141140 } else {
142- // Preserve object identity when nothing was inherited so React
143- // memoisation keeps unaffected leaves stable across renders.
144141 out . push ( locked && ! n . locked ? ( { ...n , locked : true } as LeafObject ) : n ) ;
145142 }
146143 }
147144 } ;
148- walk ( objects , false , false ) ;
145+ walk ( objects , false ) ;
149146 return out ;
150147 } , [ objects ] ) ;
151148
0 commit comments