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

ellipse.ts 984B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import CodeShape from './index'
  2. import { v4 as uuid } from 'uuid'
  3. import { EllipseShape, ShapeType } from 'types'
  4. import { vectorToPoint } from 'utils/utils'
  5. export default class Ellipse extends CodeShape<EllipseShape> {
  6. constructor(props = {} as Partial<EllipseShape>) {
  7. props.point = vectorToPoint(props.point)
  8. super({
  9. id: uuid(),
  10. type: ShapeType.Ellipse,
  11. isGenerated: true,
  12. name: 'Ellipse',
  13. parentId: 'page0',
  14. childIndex: 0,
  15. point: [0, 0],
  16. radiusX: 20,
  17. radiusY: 20,
  18. rotation: 0,
  19. isAspectRatioLocked: false,
  20. isLocked: false,
  21. isHidden: false,
  22. style: {
  23. fill: '#c6cacb',
  24. stroke: '#000',
  25. strokeWidth: 1,
  26. },
  27. ...props,
  28. })
  29. }
  30. export() {
  31. const shape = { ...this.shape }
  32. shape.point = vectorToPoint(shape.point)
  33. return shape
  34. }
  35. get radiusX() {
  36. return this.shape.radiusX
  37. }
  38. get radiusY() {
  39. return this.shape.radiusY
  40. }
  41. }