sequence.js 1.02 KB
/*
 * @Date: 2025-03-12 11:59:15
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2025-03-12 12:01:40
 * @FilePath: /logic-flow2/src/views/edge/sequence.js
 * @Description: 文件描述
 */
import { PolylineEdge, PolylineEdgeModel } from '@logicflow/core'

class SequenceModel extends PolylineEdgeModel {
  // 设置边样式
  getEdgeStyle() {
    const style = super.getEdgeStyle()
    const { properties } = this
    if (properties.isStrokeDashed) {
      style.strokeDasharray = '4, 4'
    }
    style.stroke = 'orange'
    return style
  }

  // 设置边文本样式
  getTextStyle() {
    const style = super.getTextStyle()
    style.color = '#3451F1'
    style.fontSize = 20
    style.background = Object.assign({}, style.background, {
      fill: '#F2F131',
    })
    return style
  }

  // 设置 hover 轮廓样式
  getOutlineStyle() {
    const style = super.getOutlineStyle()
    style.stroke = 'blue'
    return style
  }
}

export default {
  type: 'sequence',
  view: PolylineEdge,
  model: SequenceModel,
}