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

34 lines
801B

  1. function memoryGap() {
  2. return memorySide() + memorySpace();
  3. }
  4. function memoryGroups(c) {
  5. var items = {};
  6. // @ts-ignore
  7. var ids = utsIndexArray(c.itemsCount);
  8. ids.forEach(function (i) {
  9. // @ts-ignore
  10. items[i] = utsFloor(Number(i) / 2);
  11. });
  12. return items;
  13. }
  14. function memorySide() {
  15. return 50;
  16. }
  17. function memorySpace() {
  18. return 20;
  19. }
  20. function memoryItemPositions(c) {
  21. var pos = [];
  22. // @ts-ignore
  23. var ids = utsIndexArray(c.itemsCount);
  24. ids.forEach(function (i) {
  25. // @ts-ignore
  26. var row = utsFloor(Number(i) / 4);
  27. var x = memoryGap() + (Number(i) - row * 4) * memoryGap();
  28. var y = memoryGap() + row * memoryGap();
  29. // @ts-ignore
  30. pos.push(memoryCreatePosition(x, y));
  31. });
  32. return pos;
  33. }