Михаил Капелько 1 year ago
parent
commit
19025d4c13
8 changed files with 66 additions and 14 deletions
  1. BIN
      iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate
  2. +18
    -0
      shared/JavaScript/memoryItemPositions.js
  3. +11
    -0
      shared/Swift/memoryItemPositions.swift
  4. +1
    -0
      shared/gen
  5. +25
    -0
      shared/memoryItemPositions.ts
  6. +3
    -14
      web/memory.html
  7. +4
    -0
      будущее
  8. +4
    -0
      прошлое

BIN
iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate View File


+ 18
- 0
shared/JavaScript/memoryItemPositions.js View File

@@ -0,0 +1,18 @@
var Position = /** @class */ (function () {
function Position(x, y) {
this.x = x;
this.y = y;
}
return Position;
}());
// @ts-nocheck
function memoryItemPositions(c) {
var pos = [];
for (var i = 0; i < c.itemsCount; i++) {
var row = Math.floor(i / 4);
var x = memoryGap() + (i - row * 4) * memoryGap();
var y = memoryGap() + row * memoryGap();
pos.push(new Position(x, y));
}
return pos;
}

+ 11
- 0
shared/Swift/memoryItemPositions.swift View File

@@ -0,0 +1,11 @@
// @ts-nocheck
func memoryItemPositions(c: Context) -> [Position] {
var pos = [Position]
for (var i = 0; i < c.itemsCount; i++) {
let row = Math.floor(i / 4)
let x = memoryGap() + (i - row * 4) * memoryGap()
let y = memoryGap() + row * memoryGap()
pos.push(Position(x, y))
}
return pos
}

+ 1
- 0
shared/gen View File

@@ -4,6 +4,7 @@ SCRIPT_DIR=$(cd "$(dirname "$0")" ; pwd -P)


FILES=( FILES=(
memoryGap memoryGap
memoryItemPositions
memorySide memorySide
memorySpace memorySpace
) )


+ 25
- 0
shared/memoryItemPositions.ts View File

@@ -0,0 +1,25 @@
interface Context {
itemsCount: number
}

class Position {
x: number
y: number
constructor(x, y) {
this.x = x
this.y = y
}
}

// @ts-nocheck
function memoryItemPositions(c: Context): Position[] {
var pos: Position[] = []
for (var i = 0; i < c.itemsCount; i++) {
let row = Math.floor(i / 4)
let x = memoryGap() + (i - row * 4) * memoryGap()
let y = memoryGap() + row * memoryGap()
pos.push(new Position(x, y))
}
return pos
}

+ 3
- 14
web/memory.html View File

@@ -6,20 +6,9 @@
<body> <body>
</body> </body>
<script src="../shared/JavaScript/memoryGap.js"></script> <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/memorySide.js"></script>
<script src="../shared/JavaScript/memorySpace.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> <script>
var items = [] var items = []


@@ -39,8 +28,8 @@
for (var id in positions) { for (var id in positions) {
var p = positions[id] var p = positions[id]
var item = items[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.width = `${memorySide()}px`
item.style.height = `${memorySide()}px` item.style.height = `${memorySide()}px`
item.style.position = "absolute" item.style.position = "absolute"


+ 4
- 0
будущее View File

@@ -1,5 +1,9 @@


НАДО: НАДО:
* генерить interface в Swift
* генерить class в Swift
* нет struct, к сожалению
* генерить memoryItemPositions.swift
* генерить библиотеку на основе иных replacements * генерить библиотеку на основе иных replacements
* ввести общую библиотеку * ввести общую библиотеку
* генерить itemPositions * генерить itemPositions

+ 4
- 0
прошлое View File

@@ -1,4 +1,8 @@


02.06: 20

* геренить memoryItemPositions.js

01.06: 40 01.06: 40


* сообщать Usage * сообщать Usage


Loading…
Cancel
Save