diff options
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 |
