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/04 02:15:03 UTC
[incubator-echarts] 01/02: ts: fix types
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch label-enhancement
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit cac1f9b908c30de239756537e85fee3a7ef2e23b
Author: pissang <bm...@gmail.com>
AuthorDate: Sat Jul 4 10:14:09 2020 +0800
ts: fix types
---
src/chart/custom.ts | 2 +-
src/chart/map/MapView.ts | 2 +-
src/component/geo/GeoView.ts | 2 +-
src/component/helper/MapDraw.ts | 26 +++++++++++---------------
src/coord/geo/GeoModel.ts | 2 +-
src/echarts.ts | 2 +-
src/util/graphic.ts | 8 ++++----
7 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/src/chart/custom.ts b/src/chart/custom.ts
index 6fdb2e1..684d168 100644
--- a/src/chart/custom.ts
+++ b/src/chart/custom.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-
+// @ts-nocheck
import {__DEV__} from '../config';
import {
hasOwn, assert, isString, retrieve2, retrieve3, defaults, each, keys, isArrayLike
diff --git a/src/chart/map/MapView.ts b/src/chart/map/MapView.ts
index 6e0bd06..d5ff911 100644
--- a/src/chart/map/MapView.ts
+++ b/src/chart/map/MapView.ts
@@ -83,7 +83,7 @@ class MapView extends ChartView {
)
) {
if (mapModel.needsDrawMap) {
- const mapDraw = this._mapDraw || new MapDraw(api, true);
+ const mapDraw = this._mapDraw || new MapDraw(api);
group.add(mapDraw.group);
mapDraw.draw(mapModel, ecModel, api, this, payload);
diff --git a/src/component/geo/GeoView.ts b/src/component/geo/GeoView.ts
index 8f184da..c4587c0 100644
--- a/src/component/geo/GeoView.ts
+++ b/src/component/geo/GeoView.ts
@@ -33,7 +33,7 @@ class GeoView extends ComponentView {
private _mapDraw: MapDraw;
init(ecModel: GlobalModel, api: ExtensionAPI) {
- const mapDraw = new MapDraw(api, true);
+ const mapDraw = new MapDraw(api);
this._mapDraw = mapDraw;
this.group.add(mapDraw.group);
diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts
index 46a4d85..d95c515 100644
--- a/src/component/helper/MapDraw.ts
+++ b/src/component/helper/MapDraw.ts
@@ -71,14 +71,13 @@ class MapDraw {
private _controller: RoamController;
private _controllerHost: {
- target?: graphic.Group;
+ target: graphic.Group;
zoom?: number;
zoomLimit?: GeoCommonOptionMixin['scaleLimit'];
};
readonly group: graphic.Group;
- private _updateGroup: boolean;
/**
* This flag is used to make sure that only one among
@@ -96,14 +95,13 @@ class MapDraw {
private _backgroundGroup: graphic.Group;
- constructor(api: ExtensionAPI, updateGroup: boolean) {
+ constructor(api: ExtensionAPI) {
const group = new graphic.Group();
this.uid = getUID('ec_map_draw');
// @ts-ignore FIXME:TS
this._controller = new RoamController(api.getZr());
- this._controllerHost = {target: updateGroup ? group : null};
+ this._controllerHost = { target: group };
this.group = group;
- this._updateGroup = updateGroup;
group.add(this._regionsGroup = new graphic.Group() as RegionsGroup);
group.add(this._backgroundGroup = new graphic.Group());
@@ -370,7 +368,7 @@ class MapDraw {
this._controller.dispose();
this._mapName && geoSourceManager.removeGraphic(this._mapName, this.uid);
this._mapName = null;
- this._controllerHost = {};
+ this._controllerHost = null;
}
private _updateBackground(geo: Geo): void {
@@ -432,15 +430,13 @@ class MapDraw {
originY: e.originY
}));
- if (this._updateGroup) {
- const group = this.group;
- this._regionsGroup.traverse(function (el) {
- if (el.type === 'text') {
- el.scaleX = 1 / group.scaleX;
- el.scaleY = 1 / group.scaleY;
- }
- });
- }
+ const group = this.group;
+ this._regionsGroup.traverse(function (el) {
+ if (el.type === 'text') {
+ el.scaleX = 1 / group.scaleX;
+ el.scaleY = 1 / group.scaleY;
+ }
+ });
}, this);
controller.setPointerChecker(function (e, x, y) {
diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts
index 0158272..ba8f524 100644
--- a/src/coord/geo/GeoModel.ts
+++ b/src/coord/geo/GeoModel.ts
@@ -102,7 +102,7 @@ export interface GeoOption extends
regions: RegoinOption[];
- stateAnimation?: AnimationOption
+ stateAnimation?: AnimationOptionMixin
}
const LABEL_FORMATTER_NORMAL = ['label', 'formatter'] as const;
diff --git a/src/echarts.ts b/src/echarts.ts
index 9595ada..235fd09 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -854,7 +854,7 @@ class ECharts extends Eventful {
else if (ecData && ecData.dataIndex != null) {
const dataModel = ecData.dataModel || ecModel.getSeriesByIndex(ecData.seriesIndex);
params = (
- dataModel && dataModel.getDataParams(ecData.dataIndex, ecData.dataType, el) || {}
+ dataModel && dataModel.getDataParams(ecData.dataIndex, ecData.dataType) || {}
) as ECEvent;
}
// If element has custom eventData of components
diff --git a/src/util/graphic.ts b/src/util/graphic.ts
index 41a8e9d..cf2fb94 100644
--- a/src/util/graphic.ts
+++ b/src/util/graphic.ts
@@ -1293,7 +1293,7 @@ export function removeElement<Props>(
}
function animateOrSetLabel<Props extends PathProps>(
- isUpdate: boolean,
+ animationType: 'init' | 'update' | 'remove',
el: Element<Props>,
data: List,
dataIndex: number,
@@ -1361,7 +1361,7 @@ function animateOrSetLabel<Props extends PathProps>(
};
const props: ElementProps = {};
- animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, null, during);
+ animateOrSetProps(animationType, el, props, animatableModel, dataIndex, null, during);
}
}
@@ -1374,7 +1374,7 @@ export function updateLabel<Props>(
animatableModel?: Model<AnimationOptionMixin>,
defaultTextGetter?: (value: ParsedValue[] | ParsedValue) => string
) {
- animateOrSetLabel(true, el, data, dataIndex, labelModel, seriesModel, animatableModel, defaultTextGetter);
+ animateOrSetLabel('update', el, data, dataIndex, labelModel, seriesModel, animatableModel, defaultTextGetter);
}
export function initLabel<Props>(
@@ -1386,7 +1386,7 @@ export function initLabel<Props>(
animatableModel?: Model<AnimationOptionMixin>,
defaultTextGetter?: (value: ParsedValue[] | ParsedValue) => string
) {
- animateOrSetLabel(false, el, data, dataIndex, labelModel, seriesModel, animatableModel, defaultTextGetter);
+ animateOrSetLabel('init', el, data, dataIndex, labelModel, seriesModel, animatableModel, defaultTextGetter);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org