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.

ray.ts 854B

123456789101112131415161718192021222324252627282930313233343536
  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. seed: Math.random(),
  11. type: ShapeType.Ray,
  12. isGenerated: true,
  13. name: 'Ray',
  14. parentId: 'page1',
  15. childIndex: 0,
  16. point: [0, 0],
  17. direction: [0, 1],
  18. rotation: 0,
  19. isAspectRatioLocked: false,
  20. isLocked: false,
  21. isHidden: false,
  22. ...props,
  23. style: {
  24. ...defaultStyle,
  25. ...props.style,
  26. isFilled: false,
  27. },
  28. })
  29. }
  30. get direction(): number[] {
  31. return this.shape.direction
  32. }
  33. }