From c5ff583d3ffef5a4d09c8e7e44a459739ba097a6 Mon Sep 17 00:00:00 2001 From: plainheart Date: Mon, 8 Jul 2024 19:06:18 +0800 Subject: [PATCH] fix(legend): use `eachComponent` --- src/component/legend/legendAction.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/component/legend/legendAction.ts b/src/component/legend/legendAction.ts index 225a18d34f6..2edc27dfc28 100644 --- a/src/component/legend/legendAction.ts +++ b/src/component/legend/legendAction.ts @@ -32,8 +32,7 @@ function legendSelectActionHandler(methodName: LegendSelectMethodNames, payload: const selectedMap: Record = {}; const isToggleSelect = methodName === 'toggleSelected'; let isSelected: boolean; - const legendModels = ecModel.findComponents({ mainType: 'legend', query: payload }) as LegendModel[]; - each(legendModels, function (legendModel: LegendModel) { + ecModel.eachComponent({ mainType: 'legend', query: payload }, function (legendModel: LegendModel) { if (isToggleSelect && isSelected != null) { // Force other legend has same selected status // Or the first is toggled to true and other are toggled to false @@ -65,7 +64,6 @@ function legendSelectActionHandler(methodName: LegendSelectMethodNames, payload: } }); }); - // Return the event explicitly return (methodName === 'allSelect' || methodName === 'inverseSelect') ? {