mirror of
https://gitee.com/antv/g6.git
synced 2024-11-29 18:28:19 +08:00
fix: fix auto fit not effect when disable element animation
This commit is contained in:
parent
ded7277f12
commit
ff7a99cc20
@ -142,7 +142,8 @@ export class LayoutController {
|
||||
// 无迭代的布局,直接返回终态位置 / Layout without iteration, return final position directly
|
||||
const layoutResult = await layout.execute(data);
|
||||
if (animation) {
|
||||
this.updateElementPosition(layoutResult, animation);
|
||||
const animationResult = this.updateElementPosition(layoutResult, animation);
|
||||
await animationResult?.finished;
|
||||
}
|
||||
return layoutResult;
|
||||
}
|
||||
@ -200,7 +201,8 @@ export class LayoutController {
|
||||
applyTreeLayoutOffset(layoutPreset, offset);
|
||||
this.updateElementPosition(layoutPreset, false);
|
||||
|
||||
this.updateElementPosition(layoutResult, animation);
|
||||
const animationResult = this.updateElementPosition(layoutResult, animation);
|
||||
await animationResult?.finished;
|
||||
}
|
||||
|
||||
return layoutResult;
|
||||
|
@ -147,16 +147,21 @@ export function layoutAdapter(
|
||||
const { nodes = [], edges = [], combos = [] } = data;
|
||||
const nodesToLayout: LayoutNodeData[] = nodes.map((datum) => {
|
||||
const id = idOf(datum);
|
||||
const { data, style, combo } = datum;
|
||||
const { data, style, combo, ...rest } = datum;
|
||||
|
||||
const result = {
|
||||
id,
|
||||
data: {
|
||||
// grid 布局会直接读取 data[sortBy],兼容处理,需要避免用户 data 下使用 data, style 等字段
|
||||
// The grid layout will directly read data[sortBy], compatible processing, need to avoid users using data, style and other fields under data
|
||||
...data,
|
||||
data,
|
||||
// antv-dagre 会读取 data.parentId
|
||||
// antv-dagre will read data.parentId
|
||||
...(combo ? { parentId: combo } : {}),
|
||||
style,
|
||||
...rest,
|
||||
},
|
||||
style: { ...style },
|
||||
};
|
||||
// 一些布局会从 data 中读取位置信息
|
||||
if (style?.x) Object.assign(result.data, { x: style.x });
|
||||
|
Loading…
Reference in New Issue
Block a user