You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2021/04/08 09:02:22 UTC
[echarts] 01/04: fix: fix geo center incorrect brought by geo
refactor (test case: test/map.html 'main2')
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/geo-location
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 5ea81477400e8a588ba158bfe44d573cf3dba61c
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Apr 7 21:10:15 2021 +0800
fix: fix geo center incorrect brought by geo refactor (test case: test/map.html 'main2')
---
src/component/helper/MapDraw.ts | 1 -
src/coord/View.ts | 18 +++++++++++++-----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts
index 4d9104f..da88c3e 100644
--- a/src/component/helper/MapDraw.ts
+++ b/src/component/helper/MapDraw.ts
@@ -709,7 +709,6 @@ function resetLabelForRegion(
if (labelXY) {
// Compute a relative offset based on the el bounding rect.
const rect = el.getBoundingRect().clone();
- rect.applyTransform(el.getComputedTransform());
el.textConfig.position = [
((labelXY[0] - rect.x) / rect.width * 100) + '%',
((labelXY[1] - rect.y) / rect.height * 100) + '%'
diff --git a/src/coord/View.ts b/src/coord/View.ts
index f6a68f9..452fb0e 100644
--- a/src/coord/View.ts
+++ b/src/coord/View.ts
@@ -226,14 +226,22 @@ class View extends Transformable implements CoordinateSystemMaster, CoordinateSy
roam: ViewCoordSysTransformInfoPart
raw: ViewCoordSysTransformInfoPart
} {
- const roamTransformable = this._roamTransformable;
const rawTransformable = this._rawTransformable;
+
+ const roamTransformable = this._roamTransformable;
+ // Becuase roamTransformabel has `originX/originY` modified,
+ // but the caller of `getTransformInfo` can not handle `originX/originY`,
+ // so need to recalcualte them.
+ const dummyTransformable = new Transformable();
+ dummyTransformable.transform = roamTransformable.transform;
+ dummyTransformable.decomposeTransform();
+
return {
roam: {
- x: roamTransformable.x,
- y: roamTransformable.y,
- scaleX: roamTransformable.scaleX,
- scaleY: roamTransformable.scaleY
+ x: dummyTransformable.x,
+ y: dummyTransformable.y,
+ scaleX: dummyTransformable.scaleX,
+ scaleY: dummyTransformable.scaleY
},
raw: {
x: rawTransformable.x,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org