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.

dot.ts 865B

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