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.

polyline.ts 816B

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