mirror of
https://gitee.com/antv/g6.git
synced 2024-12-04 20:59:15 +08:00
fix: resolve miniapp errors
This commit is contained in:
parent
3c371faf5a
commit
1370d65e37
@ -125,7 +125,7 @@ const singleEdge: ShapeOptions = {
|
||||
stroke: cfg.color,
|
||||
};
|
||||
const shape =
|
||||
group.find(element => element.get('className') === 'edge-shape') || item.getKeyShape();
|
||||
group.find((element) => element.get('className') === 'edge-shape') || item.getKeyShape();
|
||||
|
||||
const { size } = cfg;
|
||||
cfg = this.getPathPoints!(cfg);
|
||||
@ -178,7 +178,7 @@ const singleEdge: ShapeOptions = {
|
||||
const labelPosition = labelCfg.position || this.labelPosition; // 文本的位置用户可以传入
|
||||
const style: LabelStyle = {};
|
||||
|
||||
const pathShape = group && group.find(element => element.get('className') === CLS_SHAPE);
|
||||
const pathShape = group && group.find((element) => element.get('className') === CLS_SHAPE);
|
||||
|
||||
// 不对 pathShape 进行判空,如果线不存在,说明有问题了
|
||||
let pointPercent;
|
||||
@ -247,7 +247,7 @@ const singleEdge: ShapeOptions = {
|
||||
if (isNil(labelCfg.autoRotate)) autoRotate = this.labelAutoRotate;
|
||||
else autoRotate = labelCfg.autoRotate;
|
||||
|
||||
const pathShape = group && group.find(element => element.get('className') === CLS_SHAPE);
|
||||
const pathShape = group && group.find((element) => element.get('className') === CLS_SHAPE);
|
||||
|
||||
// 不对 pathShape 进行判空,如果线不存在,说明有问题了
|
||||
let pointPercent;
|
||||
|
@ -327,10 +327,10 @@ export default class ItemController {
|
||||
const keyShape = (combo as ICombo).getKeyShape();
|
||||
if (!keyShape || keyShape.destroyed) return;
|
||||
(combo as ICombo).getShapeCfg(model); // 更新 combo 缓存的 size
|
||||
this.updateComboEdges(combo as ICombo)
|
||||
this.updateComboEdges(combo as ICombo);
|
||||
}, 201);
|
||||
} else {
|
||||
this.updateComboEdges(combo as ICombo)
|
||||
this.updateComboEdges(combo as ICombo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -636,7 +636,6 @@ export default class ItemController {
|
||||
item.changeVisibility(visible);
|
||||
|
||||
if (item.getType && item.getType() === NODE) {
|
||||
|
||||
const edges = (item as INode).getEdges();
|
||||
each(edges, (edge: IEdge) => {
|
||||
// 若隐藏节点,则将与之关联的边也隐藏
|
||||
|
@ -42,7 +42,7 @@ export default abstract class LayoutController {
|
||||
|
||||
const pipes = layoutCfg.pipes;
|
||||
if (Array.isArray(pipes)) {
|
||||
return pipes.map((pipe) => pipe?.type || "");
|
||||
return pipes.map((pipe) => pipe?.type || '');
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -52,7 +52,7 @@ export default abstract class LayoutController {
|
||||
const current = this.getLayoutCfgType(cfg);
|
||||
// already has pipes
|
||||
if (Array.isArray(this.layoutType)) {
|
||||
return this.layoutType.every((type, index) => type === current[index])
|
||||
return this.layoutType.every((type, index) => type === current[index]);
|
||||
}
|
||||
|
||||
return cfg?.type === this.layoutType;
|
||||
@ -159,7 +159,15 @@ export default abstract class LayoutController {
|
||||
}
|
||||
combos.push(model);
|
||||
}
|
||||
return { nodes, hiddenNodes, edges, hiddenEdges, combos, hiddenCombos, comboEdges } as GraphData;
|
||||
return {
|
||||
nodes,
|
||||
hiddenNodes,
|
||||
edges,
|
||||
hiddenEdges,
|
||||
combos,
|
||||
hiddenCombos,
|
||||
comboEdges,
|
||||
} as GraphData;
|
||||
}
|
||||
|
||||
protected reLayoutMethod(layoutMethod, layoutCfg): Promise<void> {
|
||||
@ -171,7 +179,7 @@ export default abstract class LayoutController {
|
||||
layoutCfg.onLayoutEnd = () => {
|
||||
graph.emit('aftersublayout', { type: layoutType });
|
||||
reslove();
|
||||
}
|
||||
};
|
||||
|
||||
layoutMethod.init(this.data);
|
||||
if (layoutType === 'force') {
|
||||
@ -206,9 +214,11 @@ export default abstract class LayoutController {
|
||||
start = start.then(() => this.reLayoutMethod(layoutMethod, currentCfg));
|
||||
});
|
||||
|
||||
start.then(() => {
|
||||
start
|
||||
.then(() => {
|
||||
if (layoutCfg.onAllLayoutEnd) layoutCfg.onAllLayoutEnd();
|
||||
}).catch((error) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('relayout failed', error);
|
||||
});
|
||||
}
|
||||
@ -237,14 +247,14 @@ export default abstract class LayoutController {
|
||||
}, {});
|
||||
edegsFilter = (edge) => {
|
||||
return nodesMap[edge.source] && nodesMap[edge.target];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
nodes: nodes.filter(nodesFilter),
|
||||
edges: edges.filter(edegsFilter),
|
||||
...rest
|
||||
}
|
||||
...rest,
|
||||
};
|
||||
}
|
||||
|
||||
protected getLayoutBBox(nodes) {
|
||||
@ -261,8 +271,8 @@ export default abstract class LayoutController {
|
||||
const groupNodes = Object.values(groupBy(nodes, 'layoutOrder'));
|
||||
return {
|
||||
groupNodes,
|
||||
layoutNodes
|
||||
}
|
||||
layoutNodes,
|
||||
};
|
||||
}
|
||||
|
||||
// 控制布局动画
|
||||
|
Loading…
Reference in New Issue
Block a user