Архитектурный шаблон "Мрак в моделях" на нескольких языках и платформах
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.

javaScript.js 600B

1 year ago
1234567891011121314151617181920212223242526
  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. }