Browse Source

feat: supports changing edge's target node

master
smallstonesk 4 years ago
parent
commit
75c38bea01
  1. 3
      packages/core/package.json
  2. 19
      packages/core/src/mods/flowChart/createFlowChart.ts

3
packages/core/package.json

@ -37,7 +37,7 @@
}, },
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.0.6", "@ant-design/icons": "^4.0.6",
"@antv/x6": "^0.10.63", "@antv/x6": "^0.10.66",
"ace-builds": "^1.4.12", "ace-builds": "^1.4.12",
"antd": "^4.5.3", "antd": "^4.5.3",
"react-ace": "^9.1.3", "react-ace": "^9.1.3",
@ -49,6 +49,7 @@
"@types/react-color": "^3.0.4", "@types/react-color": "^3.0.4",
"@types/react-dom": "^16.9.7", "@types/react-dom": "^16.9.7",
"awesome-typescript-loader": "^5.2.1", "awesome-typescript-loader": "^5.2.1",
"less": "^3.12.2",
"rollup": "^2.6.1", "rollup": "^2.6.1",
"rollup-plugin-postcss": "^3.1.3", "rollup-plugin-postcss": "^3.1.3",
"rollup-plugin-typescript": "^1.0.1", "rollup-plugin-typescript": "^1.0.1",

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

@ -31,6 +31,25 @@ const registerEvents = (flowChart: Graph): void => {
} }
} }
}); });
flowChart.on('edge:mouseenter', (args) => {
const cell = args.cell as Cell;
cell.addTools([
{
name: 'target-arrowhead',
args: {
attrs: {
d: 'M -10.5 -6 1 0 -10.5 6 Z',
'stroke-width': 0,
fill: '#333'
}
}
}
]);
});
flowChart.on('edge:mouseleave', (args) => {
const cell = args.cell as Cell;
cell.removeTools(['target-arrowhead']);
});
}; };
const registerShortcuts = (flowChart: Graph): void => { const registerShortcuts = (flowChart: Graph): void => {

Loading…
Cancel
Save