@@ -117,24 +117,26 @@ const gridEnabledAtom = derivedAtom(layoutStateAtom, (value) => pick(value.quali
117
117
gridEnabledAtom . bindEffect ( ( connectedClosenessSettings ) => {
118
118
if ( ! connectedClosenessSettings . enabled ) return ;
119
119
120
- // Compute the layout quality metric when node's position changed
120
+ //Compute the layout quality metric when node's position changed
121
121
const { computeLayoutQualityMetric } = layoutActions ;
122
122
const fn = debounce ( computeLayoutQualityMetric , 300 , { leading : true , maxWait : 300 } ) ;
123
123
124
124
computeLayoutQualityMetric ( ) ;
125
125
const sigmaGraph = sigmaGraphAtom . get ( ) ;
126
- // this event is triggered when sigma data are updated by the derived atom mechanism through a graph import
126
+ // this event is triggered when a sync layout has been applied
127
127
// this is a custom event
128
128
( sigmaGraph as EventEmitter ) . on ( "graphImported" , fn ) ;
129
129
130
130
// this event is triggered by user manually changing node positions by dragging node
131
- sigmaGraph . on ( "nodeAttributesUpdated" , fn ) ;
131
+ // this is a custom event
132
+ ( sigmaGraph as EventEmitter ) . on ( "nodesDragged" , fn ) ;
133
+
132
134
// this event is triggered by async layout
133
135
sigmaGraph . on ( "eachNodeAttributesUpdated" , fn ) ;
134
136
135
137
return ( ) => {
136
138
( sigmaGraph as EventEmitter ) . off ( "graphImported" , fn ) ;
139
+ ( sigmaGraph as EventEmitter ) . off ( "nodesDragged" , fn ) ;
137
140
sigmaGraph . off ( "eachNodeAttributesUpdated" , fn ) ;
138
- sigmaGraph . off ( "nodeAttributesUpdated" , fn ) ;
139
141
} ;
140
142
} ) ;
0 commit comments