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.

ellipse.ts 905B

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