From 691afc7d531d124fb88a3d0539da8b0c8658489b Mon Sep 17 00:00:00 2001 From: "linghao.su" Date: Thu, 13 Apr 2023 23:09:01 +0800 Subject: [PATCH 1/2] fix(emphasis): fix focus self not work when item emphasis by other component --- src/util/states.ts | 5 + test/emphasis-self.html | 137 ++++++++++++++++++++++++ test/runTest/actions/__meta__.json | 1 + test/runTest/actions/emphasis-self.json | 1 + 4 files changed, 144 insertions(+) create mode 100644 test/emphasis-self.html create mode 100644 test/runTest/actions/emphasis-self.json diff --git a/src/util/states.ts b/src/util/states.ts index 1748ef6f72..d1e363558c 100644 --- a/src/util/states.ts +++ b/src/util/states.ts @@ -506,6 +506,11 @@ export function blurSeries( )) { const view = api.getViewOfSeriesModel(seriesModel); view.group.traverse(function (child) { + // For the elements that have been triggered by other components, and are still required to be highlighted, + // because the current is directly forced to blur the element, it will cause the focus self to be unable to highlight, so skip the blur of this element. + if ((child as ExtendedElement).__highByOuter && sameSeries && focus === 'self') { + return; + } singleEnterBlur(child); }); diff --git a/test/emphasis-self.html b/test/emphasis-self.html new file mode 100644 index 0000000000..3bab8d8c8f --- /dev/null +++ b/test/emphasis-self.html @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json index 7ee9a15209..dae8e6ab7e 100644 --- a/test/runTest/actions/__meta__.json +++ b/test/runTest/actions/__meta__.json @@ -89,6 +89,7 @@ "ec-event": 4, "emphasis-disabled": 13, "emphasis-inherit": 1, + "emphasis-self": 1, "funnel": 2, "gauge-simple": 2, "geo-map": 4, diff --git a/test/runTest/actions/emphasis-self.json b/test/runTest/actions/emphasis-self.json new file mode 100644 index 0000000000..827d4f9958 --- /dev/null +++ b/test/runTest/actions/emphasis-self.json @@ -0,0 +1 @@ +[{"name":"Action 1","ops":[{"type":"mousemove","time":1811,"x":54,"y":598},{"type":"mousemove","time":2012,"x":87,"y":514},{"type":"mousemove","time":2213,"x":89,"y":512},{"type":"mousemove","time":2553,"x":89,"y":508},{"type":"mousemove","time":2753,"x":95,"y":399},{"type":"mousemove","time":2953,"x":97,"y":393},{"type":"mousemove","time":3119,"x":97,"y":393},{"type":"mousemove","time":3319,"x":101,"y":263},{"type":"mousemove","time":3536,"x":101,"y":263},{"type":"mousemove","time":3739,"x":101,"y":264},{"type":"mousemove","time":3944,"x":99,"y":288},{"type":"mousemove","time":4147,"x":98,"y":369},{"type":"mousemove","time":4438,"x":98,"y":369},{"type":"screenshot","time":4725},{"type":"mousemove","time":5093,"x":98,"y":369},{"type":"mousemove","time":5294,"x":113,"y":326},{"type":"mousemove","time":5503,"x":119,"y":300},{"type":"mousemove","time":5911,"x":119,"y":300},{"type":"mousemove","time":6114,"x":115,"y":323},{"type":"mousemove","time":6319,"x":111,"y":348},{"type":"mousemove","time":6519,"x":111,"y":348},{"type":"mousemove","time":6894,"x":111,"y":348},{"type":"mousemove","time":7094,"x":70,"y":338},{"type":"mousemove","time":7301,"x":29,"y":327},{"type":"screenshot","time":7914},{"type":"mousemove","time":7986,"x":30,"y":327},{"type":"mousemove","time":8190,"x":62,"y":310},{"type":"mousemove","time":8397,"x":100,"y":292},{"type":"screenshot","time":9146},{"type":"mousemove","time":9318,"x":100,"y":292},{"type":"mousemove","time":9519,"x":203,"y":282},{"type":"mousemove","time":9723,"x":204,"y":282},{"type":"screenshot","time":10410},{"type":"mousemove","time":10826,"x":204,"y":282},{"type":"mousemove","time":11027,"x":160,"y":284},{"type":"mousemove","time":11236,"x":156,"y":285},{"type":"screenshot","time":11597},{"type":"mousemove","time":11752,"x":156,"y":285},{"type":"mousemove","time":11952,"x":220,"y":286},{"type":"mousemove","time":12152,"x":221,"y":240},{"type":"mousemove","time":12355,"x":222,"y":234},{"type":"mousemove","time":12563,"x":225,"y":226},{"type":"screenshot","time":13151},{"type":"mousemove","time":13315,"x":226,"y":226},{"type":"mousemove","time":13515,"x":320,"y":212},{"type":"mousemove","time":13723,"x":328,"y":197},{"type":"screenshot","time":14231},{"type":"mousemove","time":14524,"x":328,"y":198},{"type":"mousemove","time":14724,"x":311,"y":288},{"type":"mousemove","time":14928,"x":309,"y":295},{"type":"screenshot","time":15368},{"type":"mousemove","time":15607,"x":309,"y":294},{"type":"mousemove","time":15807,"x":304,"y":70},{"type":"mousemove","time":16014,"x":289,"y":63},{"type":"mousemove","time":16219,"x":287,"y":63},{"type":"screenshot","time":16843},{"type":"mousemove","time":17024,"x":287,"y":64},{"type":"mousemove","time":17224,"x":287,"y":97},{"type":"mousemove","time":17426,"x":287,"y":98},{"type":"screenshot","time":17794},{"type":"mousemove","time":18007,"x":288,"y":98},{"type":"mousemove","time":18207,"x":367,"y":74},{"type":"mousemove","time":18419,"x":371,"y":72},{"type":"screenshot","time":19078},{"type":"mousemove","time":19282,"x":371,"y":72},{"type":"mousemove","time":19482,"x":222,"y":116},{"type":"mousemove","time":19690,"x":218,"y":116},{"type":"mousemove","time":19848,"x":217,"y":116},{"type":"mousemove","time":20048,"x":194,"y":72},{"type":"mousemove","time":20249,"x":193,"y":69},{"type":"screenshot","time":20764},{"type":"mousemove","time":20865,"x":193,"y":69},{"type":"mousemove","time":21067,"x":196,"y":71},{"type":"mousemove","time":21273,"x":196,"y":72},{"type":"mousemove","time":21473,"x":232,"y":112},{"type":"mousemove","time":21674,"x":233,"y":112}],"scrollY":0,"scrollX":0,"timestamp":1681397363763}] \ No newline at end of file From dc141d2c2d2a0ad93d0d76b26357b42937e9fafe Mon Sep 17 00:00:00 2001 From: "linghao.su" Date: Wed, 19 Apr 2023 20:51:57 +0800 Subject: [PATCH 2/2] fix(state): lint comment in states.ts --- src/util/states.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/states.ts b/src/util/states.ts index d1e363558c..3a8ad4502f 100644 --- a/src/util/states.ts +++ b/src/util/states.ts @@ -506,8 +506,10 @@ export function blurSeries( )) { const view = api.getViewOfSeriesModel(seriesModel); view.group.traverse(function (child) { - // For the elements that have been triggered by other components, and are still required to be highlighted, - // because the current is directly forced to blur the element, it will cause the focus self to be unable to highlight, so skip the blur of this element. + // For the elements that have been triggered by other components, + // and are still required to be highlighted, + // because the current is directly forced to blur the element, + // it will cause the focus self to be unable to highlight, so skip the blur of this element. if ((child as ExtendedElement).__highByOuter && sameSeries && focus === 'self') { return; }