antvis / G2

📊 The concise and progressive visualization grammar.
https://g2.antv.antgroup.com
MIT License
12.06k stars 1.58k forks source link

BUG: 自定义轴标签在缩放页面时消失 #5826

Open lxfu1 opened 8 months ago

lxfu1 commented 8 months ago

AntV Open Source Contribution Plan(可选)

Issue 类型

任务介绍

正常如下 image

缩放后 image

参考说明

  1. 访问官网示例 https://g2.antv.antgroup.com/examples/component/axis/#axis
  2. 缩放页面调整画布大小
BENcorry commented 8 months ago

【BENcorry 认领】

BENcorry commented 8 months ago

Issue 类型 补充一下哈

pearmini commented 8 months ago

@BENcorry 已经补充!

BENcorry commented 8 months ago

问题定位到是https://github.com/antvis/component/blob/48b2d5a9f0ce2e473289e6c9e937ff5ec3dabb0b/src/ui/axis/axis.ts#L77C5-L79C6 使用离屏渲染优化导致group hide的问题,这里看起来是一个实验性的优化,除了axis label之外其他的渲染不会再更新的时候做这个操作。

有点纠结是不是要删除这块代码还是用其他方式去优化这个问题。 @pearmini

pearmini commented 8 months ago

@BENcorry 我还是不是很清楚出现这个问题的原因。hide 之后不能设置回可见吗?

BENcorry commented 7 months ago

offscreenGroup导致hide的原因还不是很确定,目前可以确认的是:

  1. offscreenGroup的overlap逻辑是没有触发的,因为目前没有配置overlap,所以在processOverlap过程中不会触发offscreenGroup的逻辑。
  2. 比较神奇的是,在处理selection update的逻辑中,preLabel在offscreenGroup有时候会存在querySelector为空的情况,但是吃了一个晚饭,这个case就没复现了,我下午存在一直重复复现。把preLabel为null的时候return一个空的transitions会正常。
  3. 在transitionShape函数中,注释掉afterTransition中的destroy逻辑也会正常。
pearmini commented 7 months ago

closed by: https://github.com/antvis/G2/pull/5940