From 57b3fcf120beeaf8be1fb5cb8a416e4e8fc06c86 Mon Sep 17 00:00:00 2001 From: AndrolGenhald Date: Thu, 18 Oct 2018 10:30:20 -0500 Subject: [PATCH 1/2] Fix mouse offset when parent has position:relative --- lib/timeline/component/ItemSet.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 46246144b..c7dbf6931 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1538,12 +1538,12 @@ ItemSet.prototype._onDrag = function (event) { var me = this; var snap = this.options.snap || null; - var xOffset; + var xOffset = this.body.dom.root.getBoundingClientRect().x; if (this.options.rtl) { - xOffset = this.body.dom.root.offsetLeft + this.body.domProps.right.width; + xOffset += this.body.domProps.right.width; } else { - xOffset = this.body.dom.root.offsetLeft + this.body.domProps.left.width; + xOffset += this.body.domProps.left.width; } var scale = this.body.util.getScale(); From 367fa809d64603de80265b013f73d162551c0512 Mon Sep 17 00:00:00 2001 From: AndrolGenhald Date: Thu, 18 Oct 2018 11:19:33 -0500 Subject: [PATCH 2/2] Use getBoundingClientRect().left instead of .x According to https://caniuse.com/#feat=getboundingclientrect, IE and Edge don't have x and y values. --- lib/timeline/component/ItemSet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index c7dbf6931..740fd5f0a 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1538,7 +1538,7 @@ ItemSet.prototype._onDrag = function (event) { var me = this; var snap = this.options.snap || null; - var xOffset = this.body.dom.root.getBoundingClientRect().x; + var xOffset = this.body.dom.root.getBoundingClientRect().left; if (this.options.rtl) { xOffset += this.body.domProps.right.width;