您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import CodeShape from './index'
  2. import { v4 as uuid } from 'uuid'
  3. import { DotShape, ShapeType } from 'types'
  4. import { vectorToPoint } from 'utils/utils'
  5. import { defaultStyle } from 'lib/shape-styles'
  6. export default class Dot extends CodeShape<DotShape> {
  7. constructor(props = {} as Partial<DotShape>) {
  8. props.point = vectorToPoint(props.point)
  9. super({
  10. id: uuid(),
  11. seed: Math.random(),
  12. parentId: (window as any).currentPageId,
  13. type: ShapeType.Dot,
  14. isGenerated: true,
  15. name: 'Dot',
  16. childIndex: 0,
  17. point: [0, 0],
  18. rotation: 0,
  19. isAspectRatioLocked: false,
  20. isLocked: false,
  21. isHidden: false,
  22. ...props,
  23. style: {
  24. ...defaultStyle,
  25. ...props.style,
  26. isFilled: true,
  27. },
  28. })
  29. }
  30. export() {
  31. const shape = { ...this.shape }
  32. shape.point = vectorToPoint(shape.point)
  33. return shape
  34. }
  35. }