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 903B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. export default class Circle extends CodeShape<CircleShape> {
  6. constructor(props = {} as Partial<CircleShape>) {
  7. props.point = vectorToPoint(props.point)
  8. super({
  9. id: uuid(),
  10. type: ShapeType.Circle,
  11. isGenerated: true,
  12. name: 'Circle',
  13. parentId: 'page0',
  14. childIndex: 0,
  15. point: [0, 0],
  16. rotation: 0,
  17. radius: 20,
  18. isAspectRatioLocked: false,
  19. isLocked: false,
  20. isHidden: false,
  21. style: {
  22. fill: '#c6cacb',
  23. stroke: '#000',
  24. strokeWidth: 1,
  25. },
  26. ...props,
  27. })
  28. }
  29. export() {
  30. const shape = { ...this.shape }
  31. shape.point = vectorToPoint(shape.point)
  32. return shape
  33. }
  34. get radius() {
  35. return this.shape.radius
  36. }
  37. }