Browse Source

fix: 修复编辑流水线时流程图在动

pull/53/head
cp3hnu 1 year ago
parent
commit
afc2fbef5f
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      react-ui/src/pages/Pipeline/editPipeline/index.jsx

+ 9
- 1
react-ui/src/pages/Pipeline/editPipeline/index.jsx View File

@@ -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…
Cancel
Save