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/26 02:56:40 UTC
[incubator-echarts] branch datazoom-brush updated: feat(state):
provide enter/leave state in api
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch datazoom-brush
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/datazoom-brush by this push:
new 8e27053 feat(state): provide enter/leave state in api
8e27053 is described below
commit 8e27053714a6e03b24661ce510474b11f80201c8
Author: pissang <bm...@gmail.com>
AuthorDate: Sun Jul 26 10:56:06 2020 +0800
feat(state): provide enter/leave state in api
---
src/ExtensionAPI.ts | 6 ++++++
src/component/visualMap/ContinuousView.ts | 10 ++++++---
src/echarts.ts | 34 ++++++++++++++++++++++++++++---
3 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/src/ExtensionAPI.ts b/src/ExtensionAPI.ts
index 5211f67..ae5455e 100644
--- a/src/ExtensionAPI.ts
+++ b/src/ExtensionAPI.ts
@@ -56,6 +56,12 @@ abstract class ExtensionAPI {
// Implemented in echarts.js
abstract getCoordinateSystems(): CoordinateSystemMaster[];
abstract getComponentByElement(el: Element): ComponentModel;
+ abstract enterEmphasis(el: Element): void;
+ abstract leaveEmphasis(el: Element): void;
+ abstract enterSelect(el: Element): void;
+ abstract leaveSelect(el: Element): void;
+ abstract enterBlur(el: Element): void;
+ abstract leaveBlur(el: Element): void;
}
export default ExtensionAPI;
diff --git a/src/component/visualMap/ContinuousView.ts b/src/component/visualMap/ContinuousView.ts
index 211aec7..de7b8b0 100644
--- a/src/component/visualMap/ContinuousView.ts
+++ b/src/component/visualMap/ContinuousView.ts
@@ -35,7 +35,7 @@ import Element, { ElementEvent } from 'zrender/src/Element';
import { TextVerticalAlign, TextAlign } from 'zrender/src/core/types';
import { ColorString, Payload } from '../../util/types';
import { parsePercent } from 'zrender/src/contain/text';
-import { setAsHighDownDispatcher, enterBlur, leaveBlur } from '../../util/states';
+import { setAsHighDownDispatcher } from '../../util/states';
import { createSymbol } from '../../util/symbol';
import ZRImage from 'zrender/src/graphic/Image';
@@ -107,6 +107,8 @@ class ContinuousView extends VisualMapView {
private _firstShowIndicator: boolean;
+ private _api: ExtensionAPI;
+
doRender(
visualMapModel: ContinuousModel,
@@ -114,6 +116,8 @@ class ContinuousView extends VisualMapView {
api: ExtensionAPI,
payload: {type: string, from: string}
) {
+ this._api = api;
+
if (!payload || payload.type !== 'selectDataRange' || payload.from !== this.uid) {
this._buildView();
}
@@ -708,7 +712,7 @@ class ContinuousView extends VisualMapView {
for (let i = 0; i < handleLabels.length; i++) {
// Fade out handle labels.
// TODO not do twice.
- enterBlur(handleLabels[i]);
+ this._api.enterBlur(handleLabels[i]);
}
}
}
@@ -845,7 +849,7 @@ class ContinuousView extends VisualMapView {
if (handleLabels) {
for (let i = 0; i < handleLabels.length; i++) {
// Fade out handle labels.
- leaveBlur(handleLabels[i]);
+ this._api.leaveBlur(handleLabels[i]);
}
}
}
diff --git a/src/echarts.ts b/src/echarts.ts
index 3e745df..ca836f3 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -56,7 +56,13 @@ import {
SELECT_ACTION_TYPE,
UNSELECT_ACTION_TYPE,
TOGGLE_SELECT_ACTION_TYPE,
- savePathStates
+ savePathStates,
+ enterEmphasis,
+ leaveEmphasis,
+ leaveBlur,
+ enterSelect,
+ leaveSelect,
+ enterBlur
} from './util/states';
import * as modelUtil from './util/model';
import {throttle} from './util/throttle';
@@ -1677,8 +1683,6 @@ class ECharts extends Eventful {
updateDirectly(this, updateMethod, batchItem as Payload, 'series');
// Mark status to update
- // It can only be marked in echarts.ts.
- // So there is no chance that chart it self can trigger the highlight itself without action.
markStatusToUpdate(this);
}
else if (cptType) {
@@ -2184,6 +2188,30 @@ class ECharts extends Eventful {
el = el.parent;
}
}
+ enterEmphasis(el: Element) {
+ enterEmphasis(el);
+ markStatusToUpdate(ecIns);
+ }
+ leaveEmphasis(el: Element) {
+ leaveEmphasis(el);
+ markStatusToUpdate(ecIns);
+ }
+ enterBlur(el: Element) {
+ enterBlur(el);
+ markStatusToUpdate(ecIns);
+ }
+ leaveBlur(el: Element) {
+ leaveBlur(el);
+ markStatusToUpdate(ecIns);
+ }
+ enterSelect(el: Element) {
+ enterSelect(el);
+ markStatusToUpdate(ecIns);
+ }
+ leaveSelect(el: Element) {
+ leaveSelect(el);
+ markStatusToUpdate(ecIns);
+ }
})(ecIns);
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org