Browse Source

fix: edges can only be connected to ports

master
smallstonesk 4 years ago
parent
commit
654a0addef
  1. 10
      packages/core/src/mods/flowChart/createFlowChart.ts

10
packages/core/src/mods/flowChart/createFlowChart.ts

@ -51,12 +51,20 @@ const createFlowChart = (container: HTMLDivElement, miniMapContainer: HTMLDivEle
snap: true, snap: true,
dangling: true, dangling: true,
highlight: true, highlight: true,
anchor: 'center',
connectionPoint: 'anchor',
router: { router: {
name: 'manhattan' name: 'manhattan'
}, },
validateConnection({sourceView, targetView}) { validateConnection({sourceView, targetView, sourceMagnet, targetMagnet}) {
if(!sourceMagnet) {
return false;
} else if(!targetMagnet) {
return false;
} else {
return sourceView !== targetView; return sourceView !== targetView;
} }
}
}, },
// https://x6.antv.vision/zh/docs/tutorial/basic/background // https://x6.antv.vision/zh/docs/tutorial/basic/background
background: { background: {

Loading…
Cancel
Save