Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

circle.ts 981B

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