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

rectangle.ts 867B

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. parentId: (window as any).currentPageId,
  11. type: ShapeType.Rectangle,
  12. isGenerated: true,
  13. name: 'Rectangle',
  14. childIndex: 0,
  15. point: [0, 0],
  16. size: [100, 100],
  17. rotation: 0,
  18. radius: 2,
  19. isAspectRatioLocked: false,
  20. isLocked: false,
  21. isHidden: false,
  22. ...props,
  23. style: {
  24. ...defaultStyle,
  25. ...props.style,
  26. },
  27. })
  28. }
  29. get size(): number[] {
  30. return this.shape.size
  31. }
  32. }