Skip to content

Commit c5ff583

Browse files
committed
fix(legend): use eachComponent
1 parent 5c84ce2 commit c5ff583

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/component/legend/legendAction.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ function legendSelectActionHandler(methodName: LegendSelectMethodNames, payload:
3232
const selectedMap: Record<string, boolean> = {};
3333
const isToggleSelect = methodName === 'toggleSelected';
3434
let isSelected: boolean;
35-
const legendModels = ecModel.findComponents({ mainType: 'legend', query: payload }) as LegendModel[];
36-
each(legendModels, function (legendModel: LegendModel) {
35+
ecModel.eachComponent({ mainType: 'legend', query: payload }, function (legendModel: LegendModel) {
3736
if (isToggleSelect && isSelected != null) {
3837
// Force other legend has same selected status
3938
// Or the first is toggled to true and other are toggled to false
@@ -65,7 +64,6 @@ function legendSelectActionHandler(methodName: LegendSelectMethodNames, payload:
6564
}
6665
});
6766
});
68-
6967
// Return the event explicitly
7068
return (methodName === 'allSelect' || methodName === 'inverseSelect')
7169
? {

0 commit comments

Comments
 (0)