Skip to content

Commit f7d9e1f

Browse files
sersishen荊芥gemini-code-assist[bot]
authored
fix: 修复interaction内存在子视图时图元的获取 (#7134)
* fix: 修复存在子视图时图元的获取 * test: 修改jest配置 * Update src/interaction/action/util.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: 荊芥 <shensiqi.ssq@alibaba-inc.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 81a10f8 commit f7d9e1f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@
114114
"ts",
115115
"js",
116116
"json"
117-
]
117+
],
118+
"moduleNameMapper": {
119+
"d3-color": "d3-color/dist/d3-color.min.js",
120+
"d3-interpolate": "d3-interpolate/dist/d3-interpolate.min.js",
121+
"d3-geo": "d3-geo/build/d3-geo.min.js",
122+
"d3-path": "d3-path/dist/d3-path.min.js"
123+
}
118124
},
119125
"homepage": "https://g2.antv.vision",
120126
"repository": {

src/interaction/action/util.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ export function getElementsByState(view: View, stateName: string): Element[] {
188188
const elements = geom.getElementsBy((el) => el.hasState(stateName));
189189
rst = rst.concat(elements);
190190
});
191+
// 存在子视图
192+
if (view.views && view.views.length) {
193+
each(view.views, (subView: View) => {
194+
rst.push(...getElementsByState(subView, stateName));
195+
});
196+
}
191197
return rst;
192198
}
193199

0 commit comments

Comments
 (0)