You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/07/21 16:07:11 UTC
[incubator-echarts] branch optimize-style updated: fix(state): not
blur others when highlighting with axisPointer
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch optimize-style
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/optimize-style by this push:
new a7f2c16 fix(state): not blur others when highlighting with axisPointer
a7f2c16 is described below
commit a7f2c16ccc1e7cba889095ff8a35a4216e087dbf
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Jul 22 00:06:44 2020 +0800
fix(state): not blur others when highlighting with axisPointer
---
src/component/axisPointer/axisTrigger.ts | 18 +++++++++++++-----
src/echarts.ts | 2 +-
src/util/states.ts | 4 ++--
src/util/types.ts | 10 ++++++++++
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/component/axisPointer/axisTrigger.ts b/src/component/axisPointer/axisTrigger.ts
index 4018c9f..f9fedc9 100644
--- a/src/component/axisPointer/axisTrigger.ts
+++ b/src/component/axisPointer/axisTrigger.ts
@@ -22,7 +22,7 @@ import * as modelHelper from './modelHelper';
import findPointFromSeries from './findPointFromSeries';
import GlobalModel from '../../model/Global';
import ExtensionAPI from '../../ExtensionAPI';
-import { Dictionary, Payload, CommonAxisPointerOption } from '../../util/types';
+import { Dictionary, Payload, CommonAxisPointerOption, HighlightPayload, DownplayPayload } from '../../util/types';
import AxisPointerModel, { AxisPointerOption } from './AxisPointerModel';
import { each, curry, bind, extend, Curry1 } from 'zrender/src/core/util';
import { ZRenderType } from 'zrender/src/zrender';
@@ -479,11 +479,19 @@ function dispatchHighDownActually(
});
toDownplay.length && api.dispatchAction({
- type: 'downplay', escapeConnect: true, batch: toDownplay
- });
+ type: 'downplay',
+ escapeConnect: true,
+ // Not blur others when highlight in axisPointer.
+ notBlur: true,
+ batch: toDownplay
+ } as DownplayPayload);
toHighlight.length && api.dispatchAction({
- type: 'highlight', escapeConnect: true, batch: toHighlight
- });
+ type: 'highlight',
+ escapeConnect: true,
+ // Not blur others when highlight in axisPointer.
+ notBlur: true,
+ batch: toHighlight
+ } as HighlightPayload);
}
function findInputAxisInfo(
diff --git a/src/echarts.ts b/src/echarts.ts
index 64e4d89..0c6876e 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -1360,7 +1360,7 @@ class ECharts extends Eventful {
// If dispatchAction before setOption, do nothing.
ecModel && ecModel.eachComponent(condition, function (model) {
if (!excludeSeriesIdMap || excludeSeriesIdMap.get(model.id) == null) {
- if (isHighDownPayload(payload)) {
+ if (isHighDownPayload(payload) && !payload.notBlur) {
if (model instanceof SeriesModel) {
toggleSeriesBlurStateFromPayload(model, payload, ecIns);
}
diff --git a/src/util/states.ts b/src/util/states.ts
index 2f3c474..085ec61 100644
--- a/src/util/states.ts
+++ b/src/util/states.ts
@@ -5,7 +5,7 @@ import { PatternObject } from 'zrender/src/graphic/Pattern';
import { GradientObject } from 'zrender/src/graphic/Gradient';
import Element, { ElementEvent } from 'zrender/src/Element';
import Model from '../model/Model';
-import { DisplayState, ECElement, ColorString, BlurScope, InnerFocus, Payload, ZRColor } from './types';
+import { DisplayState, ECElement, ColorString, BlurScope, InnerFocus, Payload, ZRColor, HighlightPayload, DownplayPayload } from './types';
import { extend, indexOf, isArrayLike, isObject, keys, isArray, each } from 'zrender/src/core/util';
import { getECData } from './graphic';
import * as colorTool from 'zrender/src/tool/color';
@@ -669,7 +669,7 @@ export function isSelectChangePayload(payload: Payload) {
|| payloadType === TOGGLE_SELECT_ACTION_TYPE;
}
-export function isHighDownPayload(payload: Payload) {
+export function isHighDownPayload(payload: Payload): payload is HighlightPayload | DownplayPayload {
const payloadType = payload.type;
return payloadType === HIGHLIGHT_ACTION_TYPE
|| payloadType === DOWNPLAY_ACTION_TYPE;
diff --git a/src/util/types.ts b/src/util/types.ts
index 0c7cf84..8bb7658 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -146,6 +146,16 @@ export interface Payload extends PayloadItem {
batch?: PayloadItem[];
}
+export interface HighlightPayload extends Payload {
+ type: 'highlight';
+ notBlur?: boolean
+}
+
+export interface DownplayPayload extends Payload {
+ type: 'downplay';
+ notBlur?: boolean
+}
+
// Payload includes override anmation info
export interface PayloadAnimationPart {
duration?: number
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org