king
2025-05-13 1779677cece5864b62a65df4b01a4a69496e149a
src/menu/components/chart/antv-X6/index.jsx
@@ -3,7 +3,7 @@
import { is, fromJS } from 'immutable'
import { Popover } from 'antd'
import { ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons'
import { Graph, Shape } from '@antv/x6'
import { Graph } from '@antv/x6'
import MKEmitter from '@/utils/events.js'
import asyncComponent from '@/utils/asyncComponent'
@@ -68,8 +68,8 @@
  'mk-rect',
  {
    inherit: 'rect',
    width: 66,
    height: 36,
    width: 100,
    height: 32,
    attrs: {
      body: {
        strokeWidth: 1,
@@ -89,8 +89,8 @@
  'mk-polygon',
  {
    inherit: 'polygon',
    width: 66,
    height: 36,
    width: 100,
    height: 32,
    attrs: {
      body: {
        strokeWidth: 1,
@@ -110,8 +110,8 @@
  'mk-circle',
  {
    inherit: 'circle',
    width: 36,
    height: 36,
    width: 40,
    height: 40,
    attrs: {
      body: {
        strokeWidth: 1,
@@ -131,8 +131,8 @@
  'mk-ellipse',
  {
    inherit: 'ellipse',
    width: 66,
    height: 36,
    width: 100,
    height: 32,
    attrs: {
      body: {
        strokeWidth: 1,
@@ -152,8 +152,8 @@
  'mk-star',
  {
    inherit: 'polygon',
    width: 36,
    height: 36,
    width: 40,
    height: 40,
    points: '100,10 40,198 190,78 10,78 160,198',
    attrs: {
      body: {
@@ -175,8 +175,8 @@
  'mk-text',
  {
    inherit: 'rect',
    width: 66,
    height: 36,
    width: 100,
    height: 50,
    attrs: {
      body: {
        strokeWidth: 0,
@@ -314,6 +314,7 @@
        max: 2
      },
      autoResize: true,
      interacting: false,
      background: {
        color: card.plot.backgroundColor || 'transparent'
      },
@@ -335,36 +336,6 @@
        allowBlank: false,
        snap: {
          radius: 20
        },
        createEdge() {
          return new Shape.Edge({
            attrs: {
              line: {
                stroke: '#000000',
                strokeWidth: 1,
                targetMarker: {
                  name: 'block',
                  width: 12,
                  height: 8
                }
              }
            },
            zIndex: 0
          })
        },
        validateConnection({ targetMagnet }) {
          return !!targetMagnet
        }
      },
      highlighting: {
        magnetAdsorbed: {
          name: 'stroke',
          args: {
            attrs: {
              fill: '#5F95FF',
              stroke: '#5F95FF'
            }
          }
        }
      }
    })
@@ -391,6 +362,7 @@
        max: 2
      },
      autoResize: true,
      interacting: false,
      background: { color: '#ffffff' },
      mousewheel: {
        enabled: true,
@@ -410,55 +382,6 @@
        allowBlank: false,
        snap: {
          radius: 20
        },
        createEdge() {
          return new Shape.Edge({
            attrs: {
              line: {
                stroke: '#000000',
                strokeWidth: 1,
                targetMarker: {
                  name: 'block',
                  width: 12,
                  height: 8
                }
              }
            },
            zIndex: 2
          })
        },
        validateConnection({ targetMagnet }) {
          return !!targetMagnet
        }
      },
      highlighting: {
        magnetAdsorbed: {
          name: 'stroke',
          args: {
            attrs: {
              fill: '#5F95FF',
              stroke: '#5F95FF'
            }
          }
        }
      },
      translating: {
        restrict(cellView) {
          const cell = cellView.cell
          const parentId = cell.prop('parent')
          if (parentId) {
            const parentNode = graph.getCellById(parentId)
            if (parentNode) {
              return parentNode.getBBox().moveAndExpand({
                x: 0,
                y: 36,
                width: 0,
                height: -36,
              })
            }
          }
          return cell.getBBox()
        }
      }
    })