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

21 line
483B

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