From 373edf54a9ac76fa47e563e8d6f0f16df49c454e Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Sun, 31 Oct 2021 21:36:36 +0100 Subject: v1.0.0 --- src/modules/Chit.ts | 15 ++++++++------- src/modules/Fridge.ts | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/modules') 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 diff --git a/src/modules/Fridge.ts b/src/modules/Fridge.ts index 7137f6d..f920ad0 100644 --- a/src/modules/Fridge.ts +++ b/src/modules/Fridge.ts @@ -17,7 +17,7 @@ export default class Fridge { location.href = "/" return; } - // sessionStorage.clear() + sessionStorage.clear() const fdb = JSON.parse(f) as FridgeFromDb; if (fdb.mileage != null && fdb.cs != null) { -- cgit v1.3.1