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

rectangle.ts 893B

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