refactor: support pre layout process #6630
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
优化结果:以 layoutConcentric 为例,从 75 ms 降低至 55 ms(
约 26%
)优化前渲染时长为: 75 ms
优化后渲染时长为:55 ms
理想状态下具有布局的图场景首屏渲染时长能够缩短约
20~30%
Breaking Change
使用前布局流程会导致首屏动画发生变化
后布局效果(当前):
前布局效果:
以 Mindmap 为例,其标签方向基于节点及其父节点计算得出,后渲染流程会执行二次更新,此时节点数据中已经具有坐标信息,因此可以正确计算。
而采用前布局后,没有二次更新流程,首次计算无法获取节点坐标。
针对该问题,后续可以通过 transform 中 afterLayout hook 进行处理。