diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2021-10-24 18:59:50 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2021-10-24 18:59:50 +0200 |
| commit | 55d0e202677253ecf893bd52649871f10b52d3de (patch) | |
| tree | 23fc8b3b06bef4ff7503c100edcea2ed01a298d5 /src/modules/Fridge.ts | |
| parent | 94ca5987544009f2da17fe27abc6c9de380d34fd (diff) | |
| download | isiqandisi-55d0e202677253ecf893bd52649871f10b52d3de.tar.gz isiqandisi-55d0e202677253ecf893bd52649871f10b52d3de.tar.zst isiqandisi-55d0e202677253ecf893bd52649871f10b52d3de.zip | |
Almost dragging and WYSiWYG start
Diffstat (limited to 'src/modules/Fridge.ts')
| -rw-r--r-- | src/modules/Fridge.ts | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/modules/Fridge.ts b/src/modules/Fridge.ts new file mode 100644 index 0000000..79da4dc --- /dev/null +++ b/src/modules/Fridge.ts @@ -0,0 +1,44 @@ +import Chit, { ChitFromDb } from "Modules/Chit" + +export default class Fridge { + #chits: Chit[] = []; + + constructor() { + const f = sessionStorage.fridge; + if (f === null) { + location.href = "/" + return; + } + const cs = JSON.parse(f) as ChitFromDb[]; + for (const c of cs) { + this.#chits.push(new Chit(this, c)) + } + } + + setChitZIAuto() { + for (const c of this.#chits) + c.div.style.zIndex = "auto" + } + // moveChit(coord: { top: number, left: number }) { + // for (const c of this.#chits) { + // if (c.isMoving) { + // c.move(coord) + // } + // } + // } + // stopChitMove() { + // for (const c of this.#chits) { + // c.isMoving = false; + // //@ts-expect-error + // c.mouseUpH({ preventDefault: () => null }) + // } + // } + + createChit() { + this.#chits.push(new Chit(this)) + } + + get chits(): Chit[] { + return this.#chits; + } +} |
