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.

line.ts 869B

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