antvis/G6

The issue has been closed
浏览器通过document.body.style.zoom来进行页面自适应后,图表绘制完后鼠标的各种事件出现错位或偏移问题 #4436
SuyarAyoM posted onGitHub
问题描述
问题原因:使用谷歌浏览器,将页面缩放显示放大超过100%,然后使用web页面的高宽进行计算得到市面上现在正常的分辨率(1920*1080)缩放比,通过document.body.style.zoom设置后,再进行图形绘制出现鼠标的各种事件出现错位或偏移问题。
以下是设置分辨率代码:
const {offsetWidth, offsetHeight} = document.body;
const scale = offsetWidth / 1920
if(scale < 1){
document.body.style.zoom = scale;
document.body.style['transform-origin'] = 0 0
;
document.body.style.height = (offsetHeight / scale)+'px';
}
目前通过测试发现360浏览器,火狐浏览器没有问题,谷歌浏览器出现偏移问题
重现链接
-
重现步骤
-
预期行为
-
平台
-操作系统: Windows
- 网页浏览器: [Google Chrome]
- G6 版本: [4.2.4]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response