fix: 修复编辑流水线时流程图在动
This commit is contained in:
parent
7e8935f471
commit
afc2fbef5f
|
@ -51,8 +51,16 @@ const EditPipeline = () => {
|
|||
return item.id === val.id;
|
||||
});
|
||||
data.nodes[index] = val;
|
||||
const zoom = graph.getZoom();
|
||||
// 在拉取新数据重新渲染页面之前先获取点(0, 0)在画布上的位置
|
||||
const lastPoint = graph.getCanvasByPoint(0, 0);
|
||||
graph.changeData(data);
|
||||
graph.render();
|
||||
graph.zoomTo(zoom);
|
||||
// 获取重新渲染之后点(0, 0)在画布的位置
|
||||
const newPoint = graph.getCanvasByPoint(0, 0);
|
||||
// 移动画布相对位移;
|
||||
graph.translate(lastPoint.x - newPoint.x, lastPoint.y - newPoint.y);
|
||||
}
|
||||
};
|
||||
const savePipeline = async (val) => {
|
||||
|
@ -432,7 +440,7 @@ const EditPipeline = () => {
|
|||
height: graphRef.current.clientHeight || '100%',
|
||||
animate: false,
|
||||
groupByTypes: false,
|
||||
fitView: false,
|
||||
fitView: true,
|
||||
plugins: [contextMenu],
|
||||
enabledStack: true,
|
||||
modes: {
|
||||
|
|
Loading…
Reference in New Issue