| | |
| | | import React, { useRef, useEffect } from "react"; |
| | | import { Graph, Shape } from "@antv/x6"; |
| | | |
| | | const commonGraphPorts = { |
| | | groups: { |
| | |
| | | position: 'top', |
| | | attrs: { |
| | | circle: { |
| | | magnet: true, |
| | | stroke: '#8f8f8f', |
| | | r: 5, |
| | | magnet: true, |
| | | stroke: '#5F95FF', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | style: { |
| | | visibility: 'hidden', |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | position: 'bottom', |
| | | attrs: { |
| | | circle: { |
| | | magnet: true, |
| | | stroke: '#8f8f8f', |
| | | r: 5, |
| | | magnet: true, |
| | | stroke: '#5F95FF', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | style: { |
| | | visibility: 'hidden', |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | position: 'left', |
| | | attrs: { |
| | | circle: { |
| | | magnet: true, |
| | | stroke: '#8f8f8f', |
| | | r: 5, |
| | | magnet: true, |
| | | stroke: '#5F95FF', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | style: { |
| | | visibility: 'hidden', |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | position: 'right', |
| | | attrs: { |
| | | circle: { |
| | | magnet: true, |
| | | stroke: '#8f8f8f', |
| | | r: 5, |
| | | magnet: true, |
| | | stroke: '#5F95FF', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | style: { |
| | | visibility: 'hidden', |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | }, |
| | | } |
| | | |
| | | 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 } |