私信发送成功
检测到您已登录开源中国,是否 一键登录码云
Watch Star

ECharts / echartsJavaScriptBSD-3-Clause

Fix 6211 (tooltip position incorrect when moved in bmap)
pah100 提交于   master
commit b3f3425e116b3cc49e550aa1162b96c8ff343378
1 parent 640d3548c8

2 文件发生了变化, 影响行数: +11 -5

@@ -133,7 +133,8 @@ define(function (require) {
 
// TODO Dispose
ecModel.eachComponent('bmap', function (bmapModel) {
- var viewportRoot = api.getZr().painter.getViewportRoot();
+ var painter = api.getZr().painter;
+ var viewportRoot = painter.getViewportRoot();
if (typeof BMap === 'undefined') {
throw new Error('BMap api is not loaded');
}
@@ -160,6 +161,11 @@ define(function (require) {
 
var overlay = new Overlay(viewportRoot);
bmap.addOverlay(overlay);
+
+ // Override
+ painter.getViewportRootOffset = function () {
+ return {offsetLeft: 0, offsetTop: 0};
+ };
}
var bmap = bmapModel.__bmap;
 
@@ -219,10 +219,10 @@ define(function (require) {
// the sibling of canvas root. So padding of ec container
// should be considered here.
var zr = this._zr;
- var viewportRoot;
- if (zr && zr.painter && (viewportRoot = zr.painter.getViewportRoot())) {
- x += viewportRoot.offsetLeft || 0;
- y += viewportRoot.offsetTop || 0;
+ var viewportRootOffset;
+ if (zr && zr.painter && (viewportRootOffset = zr.painter.getViewportRootOffset())) {
+ x += viewportRootOffset.offsetLeft;
+ y += viewportRootOffset.offsetTop;
}
 
var style = this.el.style;

登录 后才可以发表评论