luxiaotao1123
2024-03-04 babcf4f0462ed0945fcefe59b1666d709910872c
zy-asrs-flow/src/components/Flow/GraphConfig.jsx
@@ -1,4 +1,5 @@
import React, { useRef, useEffect } from "react";
import { Graph, Shape } from "@antv/x6";
const commonGraphPorts = {
    groups: {
@@ -6,9 +7,14 @@
            position: 'top',
            attrs: {
                circle: {
                    magnet: true,
                    stroke: '#8f8f8f',
                    r: 5,
                    magnet: true,
                    stroke: '#5F95FF',
                    strokeWidth: 1,
                    fill: '#fff',
                    style: {
                        visibility: 'hidden',
                    },
                },
            },
        },
@@ -16,9 +22,14 @@
            position: 'bottom',
            attrs: {
                circle: {
                    magnet: true,
                    stroke: '#8f8f8f',
                    r: 5,
                    magnet: true,
                    stroke: '#5F95FF',
                    strokeWidth: 1,
                    fill: '#fff',
                    style: {
                        visibility: 'hidden',
                    },
                },
            },
        },
@@ -26,9 +37,14 @@
            position: 'left',
            attrs: {
                circle: {
                    magnet: true,
                    stroke: '#8f8f8f',
                    r: 5,
                    magnet: true,
                    stroke: '#5F95FF',
                    strokeWidth: 1,
                    fill: '#fff',
                    style: {
                        visibility: 'hidden',
                    },
                },
            },
        },
@@ -36,9 +52,14 @@
            position: 'right',
            attrs: {
                circle: {
                    magnet: true,
                    stroke: '#8f8f8f',
                    r: 5,
                    magnet: true,
                    stroke: '#5F95FF',
                    strokeWidth: 1,
                    fill: '#fff',
                    style: {
                        visibility: 'hidden',
                    },
                },
            },
        },
@@ -71,4 +92,39 @@
    },
}
export { commonGraphPorts, commonGraphAttrs }
const initGraphConnecting = {
    router: 'manhattan',
    connector: {
        name: 'rounded',
        args: {
            radius: 8,
        },
    },
    anchor: 'center',
    connectionPoint: 'anchor',
    allowBlank: false,
    snap: {
        radius: 20,
    },
    createEdge() {
        return new Shape.Edge({
            attrs: {
                line: {
                    stroke: '#A2B1C3',
                    strokeWidth: 2,
                    targetMarker: {
                        name: 'block',
                        width: 12,
                        height: 8,
                    },
                },
            },
            zIndex: 0,
        })
    },
    validateConnection({ targetMagnet }) {
        return !!targetMagnet
    },
}
export { commonGraphPorts, commonGraphAttrs, initGraphConnecting }