You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2020/10/14 05:50:44 UTC
[incubator-echarts] 01/01: fix(extension/bmap): fix bmap first
layout may be incorrect if container's layout is flex or grid.(#13424)
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch fix/bmap
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 2bcd3f992e4dcd7df26471ac617048c0299896d5
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Wed Oct 14 13:50:07 2020 +0800
fix(extension/bmap): fix bmap first layout may be incorrect if container's layout is flex or grid.(#13424)
---
extension-src/bmap/BMapCoordSys.ts | 6 +++---
extension-src/bmap/BMapView.ts | 12 ++++++++++--
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/extension-src/bmap/BMapCoordSys.ts b/extension-src/bmap/BMapCoordSys.ts
index ffe4393..79ec79f 100644
--- a/extension-src/bmap/BMapCoordSys.ts
+++ b/extension-src/bmap/BMapCoordSys.ts
@@ -177,9 +177,9 @@ BMapCoordSys.create = function (ecModel, api) {
root.removeChild(bmapRoot);
}
bmapRoot = document.createElement('div');
- bmapRoot.style.cssText = 'width:100%;height:100%';
- // Not support IE8
- bmapRoot.classList.add('ec-extension-bmap');
+ bmapRoot.className = 'ec-extension-bmap';
+ // fix #13424
+ bmapRoot.style.cssText = 'position:absolute;width:100%;height:100%';
root.appendChild(bmapRoot);
// initializes bmap
diff --git a/extension-src/bmap/BMapView.ts b/extension-src/bmap/BMapView.ts
index 5639329..c125f6c 100644
--- a/extension-src/bmap/BMapView.ts
+++ b/extension-src/bmap/BMapView.ts
@@ -47,8 +47,16 @@ export default echarts.extendComponentView({
-parseInt(offsetEl.style.left, 10) || 0,
-parseInt(offsetEl.style.top, 10) || 0
];
- viewportRoot.style.left = mapOffset[0] + 'px';
- viewportRoot.style.top = mapOffset[1] + 'px';
+ // only update style when map offset changed
+ const viewportRootStyle = viewportRoot.style;
+ const offsetLeft = mapOffset[0] + 'px';
+ const offsetTop = mapOffset[1] + 'px';
+ if (viewportRootStyle.left !== offsetLeft) {
+ viewportRootStyle.left = offsetLeft;
+ }
+ if (viewportRootStyle.top !== offsetTop) {
+ viewportRootStyle.top = offsetTop;
+ }
coordSys.setMapOffset(mapOffset);
bMapModel.__mapOffset = mapOffset;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org