draw.ts 533 Bytes
import { CellAttributeKeyEnum } from '@/enums/cellAttributeEnum'
import type { MxCell } from '@/fitCore/types'

export const genComponentInstanceId = (cell: MxCell) => {
  const id = cell.getId()
  const shapeKey = cell.getAttribute(CellAttributeKeyEnum.SHAPE_KEY)
  return `${shapeKey}_${id}`
}

export const getAppInstanceId = (cell: MxCell) => {
  return `${genComponentInstanceId(cell)}__app`
}

export const genShapeKey = (category: string, componentKey: string) => {
  return `mxgraph.thingskit/${category}/${componentKey}`
}