Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import CodeShape from './index'
  2. import { uniqueId } from 'utils'
  3. import { RayShape, ShapeProps, ShapeType } from 'types'
  4. import { defaultStyle } from 'state/shape-styles'
  5. /* ----------------- Start Copy Here ---------------- */
  6. export default class Ray extends CodeShape<RayShape> {
  7. constructor(props = {} as ShapeProps<RayShape>) {
  8. super({
  9. id: uniqueId(),
  10. type: ShapeType.Ray,
  11. isGenerated: true,
  12. name: 'Ray',
  13. parentId: 'page1',
  14. childIndex: 0,
  15. point: [0, 0],
  16. direction: [0, 1],
  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. /**
  30. * The ray's direction.
  31. *
  32. * ```ts
  33. * const shapeDirection = shape.direction
  34. *
  35. * shape.direction = [0,0]
  36. * ```
  37. */
  38. get direction(): number[] {
  39. return this.shape.direction
  40. }
  41. set direction(direction: number[]) {
  42. this.utils.setProperty(this.shape, 'direction', direction)
  43. }
  44. }