From 31186d99a6f485a3621a546b12c3180086a3dd79 Mon Sep 17 00:00:00 2001 From: mhalfmann Date: Mon, 8 Apr 2019 12:31:50 +0200 Subject: [PATCH] fixed bug when resizing scaled pads --- dist/iwmlib.js | 8 ++++---- lib/scatter.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/iwmlib.js b/dist/iwmlib.js index 94b643b..bf9abd5 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -4149,12 +4149,12 @@ e.preventDefault(); let event = new CustomEvent('resizeStarted'); - let oldPostition = {x: this.element.offsetLeft, y: this.element.offsetTop}; + let oldPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; this.bringToFront(); this.element.style.transformOrigin = "0% 0%"; - let newPostition = {x: this.element.offsetLeft, y: this.element.offsetTop}; + let newPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; let offset = Points.subtract(oldPostition, newPostition); @@ -4207,9 +4207,9 @@ e.preventDefault(); let event = new CustomEvent('resizeEnded'); - let oldPostition = {x: this.element.offsetLeft, y: this.element.offsetTop}; + let oldPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; this.element.style.transformOrigin = "50% 50%"; - let newPostition = {x: this.element.offsetLeft, y: this.element.offsetTop}; + let newPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; let offset = Points.subtract(oldPostition, newPostition); TweenLite.to(this.element, 0, { css: { left: "+=" + offset.x + "px" } }); diff --git a/lib/scatter.js b/lib/scatter.js index 565518c..e08f31c 100644 --- a/lib/scatter.js +++ b/lib/scatter.js @@ -1386,12 +1386,12 @@ export class DOMScatter extends AbstractScatter { e.preventDefault() let event = new CustomEvent('resizeStarted') - let oldPostition = {x: this.element.offsetLeft, y: this.element.offsetTop} + let oldPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; this.bringToFront() this.element.style.transformOrigin = "0% 0%" - let newPostition = {x: this.element.offsetLeft, y: this.element.offsetTop} + let newPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; let offset = Points.subtract(oldPostition, newPostition) @@ -1444,9 +1444,9 @@ export class DOMScatter extends AbstractScatter { e.preventDefault() let event = new CustomEvent('resizeEnded') - let oldPostition = {x: this.element.offsetLeft, y: this.element.offsetTop} + let oldPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; this.element.style.transformOrigin = "50% 50%" - let newPostition = {x: this.element.offsetLeft, y: this.element.offsetTop} + let newPostition = {x: this.element.getBoundingClientRect().left, y: this.element.getBoundingClientRect().top}; let offset = Points.subtract(oldPostition, newPostition) TweenLite.to(this.element, 0, { css: { left: "+=" + offset.x + "px" } })