diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-08-11 01:09:44 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-08-11 01:09:44 -0400 |
commit | 2e67661f0016874b7afbfeeb773401b94d5cefcd (patch) | |
tree | 2d29b2559a783cd986c4d5fcead47843e01d8270 /scripts/cards/drag.js | |
parent | 5f7ffa76984da87c7b67be24f392a6ff50f5a8a2 (diff) |
Fix dragging for scaled cards
Diffstat (limited to 'scripts/cards/drag.js')
-rw-r--r-- | scripts/cards/drag.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/cards/drag.js b/scripts/cards/drag.js index fa1ef65..ec82ade 100644 --- a/scripts/cards/drag.js +++ b/scripts/cards/drag.js @@ -62,8 +62,8 @@ class MultiDrag extends EventTarget { cap.drag = this.addDragEl( e.target, - e.pageX - parseInt(e.target.style.left), - e.pageY - parseInt(e.target.style.top), + e.pageX - parseInt(e.target.style.getPropertyValue("--left")), + e.pageY - parseInt(e.target.style.getPropertyValue("--top")), e.target.style.left, e.target.style.top, e.target.style.transitionDuration @@ -88,8 +88,8 @@ class MultiDrag extends EventTarget { this.drag[i].e.style.transitionDuration = this.drag[i].ptd; if(this.ret) { - this.drag[i].e.style.left = this.drag[i].prx; - this.drag[i].e.style.top = this.drag[i].pry; + this.drag[i].e.style.setProperty("--left", this.drag[i].prx + "px"); + this.drag[i].e.style.setProperty("--top", this.drag[i].pry + "px"); } cap.drag = this.drag.splice(i, 1); @@ -123,8 +123,8 @@ class MultiDrag extends EventTarget { this.drag[0].e.style.transitionDuration = this.drag[0].ptd; if(this.ret) { - this.drag[0].e.style.left = this.drag[0].prx; - this.drag[0].e.style.top = this.drag[0].pry; + this.drag[0].e.style.setProperty("--left", this.drag[0].prx + "px"); + this.drag[0].e.style.setProperty("--top", this.drag[0].pry + "px"); } cap.drag.push(this.drag.shift()); @@ -140,8 +140,8 @@ class MultiDrag extends EventTarget { this.mouse[1] = e.pageY; for (let i = 0; i < this.drag.length && !this.del; i++) { - this.drag[i].e.style.left = e.pageX - this.drag[i].osx + "px"; - this.drag[i].e.style.top = e.pageY - this.drag[i].osy + "px"; + this.drag[i].e.style.setProperty("--left", e.pageX - this.drag[i].osx + "px"); + this.drag[i].e.style.setProperty("--top", e.pageY - this.drag[i].osy + "px"); } } |