Архитектурный шаблон "Мрак в моделях" на нескольких языках и платформах
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
600B

  1. var Position = /** @class */ (function () {
  2. function Position(x, y) {
  3. this.x = x;
  4. this.y = y;
  5. }
  6. return Position;
  7. }());
  8. function memoryGap() {
  9. return memorySide() + memorySpace();
  10. }
  11. function memorySide() {
  12. return 50;
  13. }
  14. function memorySpace() {
  15. return 20;
  16. }
  17. function memoryItemPositions(c) {
  18. var pos = [];
  19. for (var i = 0; i < c.itemsCount; i++) {
  20. var row = Math.floor(i / 4);
  21. var x = memoryGap() + (i - row * 4) * memoryGap();
  22. var y = memoryGap() + row * memoryGap();
  23. pos.push(new Position(x, y));
  24. }
  25. return pos;
  26. }