物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
901 B

  1. // 自定义默认分组
  2. class MyGroup extends window.GroupNode.view {}
  3. class MyGroupModel extends window.GroupNode.model {
  4. initNodeData(data) {
  5. super.initNodeData(data)
  6. const { properties } = this
  7. this.isRestrict = true
  8. this.isGroup = true
  9. this.resizable = true
  10. this.width = properties.width
  11. this.height = properties.height
  12. }
  13. setAttributes() {
  14. const { x, y, properties } = this
  15. this.text = {
  16. ...this.text,
  17. x,
  18. y,
  19. value: properties.content || '',
  20. }
  21. }
  22. getNodeStyle() {
  23. const style = super.getNodeStyle()
  24. style.stroke = 'transparent'
  25. style.strokeDasharray = '3 3'
  26. style.strokeWidth = 2
  27. style.fill = 'transparent'
  28. const { properties } = this
  29. style.x = properties.x
  30. style.y = properties.y
  31. return style
  32. }
  33. }
  34. export default {
  35. type: 'default-group',
  36. model: MyGroupModel,
  37. view: MyGroup,
  38. }