From 761de46f80a7999554990bd99953d7374b573396 Mon Sep 17 00:00:00 2001 From: sushuang Date: Mon, 9 Sep 2019 22:15:41 +0800 Subject: [PATCH] fix(custom series): the hover style should be always set but should not cache in hover state, otherwise the previous cache will be not reset and the previous hover style will remain; fix #11103. --- src/chart/custom.js | 16 ++---- test/hoverStyle.html | 134 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 12 deletions(-) diff --git a/src/chart/custom.js b/src/chart/custom.js index 453af472f3..a48f187d2f 100644 --- a/src/chart/custom.js +++ b/src/chart/custom.js @@ -318,19 +318,11 @@ function updateEl(el, dataIndex, elOption, animatableModel, data, isInit, isRoot // If `elOption.styleEmphasis` is `false`, remove hover style. The // logic is ensured by `graphicUtil.setElementHoverStyle`. var styleEmphasis = elOption.styleEmphasis; - var disableStyleEmphasis = styleEmphasis === false; - if (!( - // Try to escapse setting hover style for performance. - (el.__cusHasEmphStl && styleEmphasis == null) - || (!el.__cusHasEmphStl && disableStyleEmphasis) - )) { - // Should not use graphicUtil.setHoverStyle, since the styleEmphasis - // should not be share by group and its descendants. - graphicUtil.setElementHoverStyle(el, styleEmphasis); - el.__cusHasEmphStl = !disableStyleEmphasis; - } + // hoverStyle should always be set here, because if the hover style + // may already be changed, where the inner cache should be reset. + graphicUtil.setElementHoverStyle(el, styleEmphasis); if (isRoot) { - graphicUtil.setAsHighDownDispatcher(el, !disableStyleEmphasis); + graphicUtil.setAsHighDownDispatcher(el, styleEmphasis !== false); } } diff --git a/test/hoverStyle.html b/test/hoverStyle.html index 807aa405b8..e5bf376b1c 100644 --- a/test/hoverStyle.html +++ b/test/hoverStyle.html @@ -54,6 +54,9 @@
+
+
+
@@ -152,6 +155,137 @@ + + + + + + + + +