diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2021-10-31 21:36:36 +0100 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2021-10-31 21:36:36 +0100 |
| commit | 373edf54a9ac76fa47e563e8d6f0f16df49c454e (patch) | |
| tree | 31bc9a027d1ce6658758f5678850166720b105bb /src/modules/Chit.ts | |
| parent | 27075885e95bd0efc062920685e04287feb4b556 (diff) | |
| download | isiqandisi-373edf54a9ac76fa47e563e8d6f0f16df49c454e.tar.gz isiqandisi-373edf54a9ac76fa47e563e8d6f0f16df49c454e.tar.zst isiqandisi-373edf54a9ac76fa47e563e8d6f0f16df49c454e.zip | |
v1.0.0
Diffstat (limited to 'src/modules/Chit.ts')
| -rw-r--r-- | src/modules/Chit.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/Chit.ts b/src/modules/Chit.ts index 7d7169a..e475eba 100644 --- a/src/modules/Chit.ts +++ b/src/modules/Chit.ts @@ -69,6 +69,8 @@ export default class Chit { moveOrResize(e: MouseEvent, what: "mov" | "res") { e.stopPropagation() const [sx, sy] = [e.x, e.y] + const [ssx, ssy] = [this.#left, this.#top] + const [ssw, ssh] = [this.#width, this.#height] let top = this.#top, left = this.#left, width = this.#width, height = this.#height; this.color = this.cCol; this.#fridge.makeTrans(this); @@ -82,25 +84,24 @@ export default class Chit { if (ee.x !== ee.clientX) throw new Error("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") if (what === "mov") { - top = this.#top - dy; - left = this.#left - dx; + top = ssy - dy; + left = ssx - dx; this.#div.style.top = top + 'px'; this.#div.style.left = left + 'px'; } else { const m = 150; - width = this.#width - dx > m ? this.#width - dx : m - height = this.#height - dy > m ? this.#height - dy : m + width = ssw - dx > m ? ssw - dx : m + height = ssh - dy > m ? ssh - dy : m this.#div.style.width = width + "px" this.#div.style.height = height + "px" } - } - - const stopRes = () => { this.top = top this.left = left this.width = width this.height = height + } + const stopRes = () => { this.color = this.nCol; this.save() document.onmousemove = () => null |
