### Version 1.26.1 ### Link to Minimal Reproduction https://visactor.io/vtable/demo/gantt/gantt-datazoom ### Steps to Reproduce 在 [Gantt.ts 构造函数]中,执行顺序是: 先初始化 ZoomScaleManager(如果配置了 zoomScale) ZoomScaleManager 内部会尝试从 levels 中找到合适的级别并设置 scales 然后调用 _sortScales() 问题出在 [_sortScales]方法中,第 693 行取 timelineHeader.scales 赋值给 timelineScales,第 695 行直接访问 timelineScales.length,但没有检查 timelineScales 是否为 undefined。当用户只配了 zoomScale 但没配 scales 时,如果 zoomScale.levels 为空或初始化失败,setInitialLevel 不会执行,timelineHeader.scales 就仍然是 undefined,导致报错。 ### Current Behavior 当前必须配置scales和zoomScale中的level,并且初始化会使用scales中的缩放比例,当用户拖动滚动条后会根据缩放比例切换到zoomScale中的level,体验比较割裂 https://github.com/user-attachments/assets/f842d9ba-09b0-427d-8a6b-d856ac7ec8b7 ### Expected Behavior 可以直接采用zoomScale中的level配置 ### Environment ```markdown - OS: - Browser: - Framework: ``` ### Any additional comments? _No response_
Version
1.26.1
Link to Minimal Reproduction
https://visactor.io/vtable/demo/gantt/gantt-datazoom
Steps to Reproduce
在 [Gantt.ts 构造函数]中,执行顺序是:
先初始化 ZoomScaleManager(如果配置了 zoomScale)
ZoomScaleManager 内部会尝试从 levels 中找到合适的级别并设置 scales
然后调用 _sortScales()
问题出在 [_sortScales]方法中,第 693 行取 timelineHeader.scales 赋值给 timelineScales,第 695 行直接访问 timelineScales.length,但没有检查 timelineScales 是否为 undefined。当用户只配了 zoomScale 但没配 scales 时,如果 zoomScale.levels 为空或初始化失败,setInitialLevel 不会执行,timelineHeader.scales 就仍然是 undefined,导致报错。
Current Behavior
当前必须配置scales和zoomScale中的level,并且初始化会使用scales中的缩放比例,当用户拖动滚动条后会根据缩放比例切换到zoomScale中的level,体验比较割裂
20260610_112131.mp4
Expected Behavior
可以直接采用zoomScale中的level配置
Environment
Any additional comments?
No response