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.

circle.ts 881B

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