|
|
@@ -6,20 +6,9 @@ |
|
|
|
<body> |
|
|
|
</body> |
|
|
|
<script src="../shared/JavaScript/memoryGap.js"></script> |
|
|
|
<script src="../shared/JavaScript/memoryItemPositions.js"></script> |
|
|
|
<script src="../shared/JavaScript/memorySide.js"></script> |
|
|
|
<script src="../shared/JavaScript/memorySpace.js"></script> |
|
|
|
<script> |
|
|
|
function memoryItemPositions(M) { |
|
|
|
var pos = [] |
|
|
|
for (var i = 0; i < M.itemsCount; i++) { |
|
|
|
let row = Math.floor(i / 4) |
|
|
|
let x = memoryGap() + (i - row * 4) * memoryGap() |
|
|
|
let y = memoryGap() + row * memoryGap() |
|
|
|
pos.push([x, y]) |
|
|
|
} |
|
|
|
return pos |
|
|
|
} |
|
|
|
</script> |
|
|
|
<script> |
|
|
|
var items = [] |
|
|
|
|
|
|
@@ -39,8 +28,8 @@ |
|
|
|
for (var id in positions) { |
|
|
|
var p = positions[id] |
|
|
|
var item = items[id]; |
|
|
|
item.style.left = `${p[0]}px` |
|
|
|
item.style.top = `${p[1]}px` |
|
|
|
item.style.left = `${p.x}px` |
|
|
|
item.style.top = `${p.y}px` |
|
|
|
item.style.width = `${memorySide()}px` |
|
|
|
item.style.height = `${memorySide()}px` |
|
|
|
item.style.position = "absolute" |
|
|
|