Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

rectangle.ts 924B

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