From 888db7a3b45a789b7e67e602a0002200a8219e18 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Sun, 9 Mar 2014 21:29:48 +0000 Subject: [PATCH 1/1] Firefox-friendly calculation of dragstart offset (personally I am not feeling very Firefox-friendly right now) --- app/assets/javascripts/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index e5f6fe478..2b5f23ef1 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -361,8 +361,10 @@ $(document).ready(function () { $(".routing_marker").on('dragstart',function(e) { e.originalEvent.dataTransfer.effectAllowed = 'move'; e.originalEvent.dataTransfer.setData('id', this.id); - e.originalEvent.dataTransfer.setData('offsetX', e.originalEvent.target.width/2 - (e.originalEvent.x-e.target.x)); - e.originalEvent.dataTransfer.setData('offsetY', e.originalEvent.target.height - (e.originalEvent.y-e.target.y)); + var xo=e.originalEvent.clientX - $(e.target).offset().left; + var yo=e.originalEvent.clientY - $(e.target).offset().top; + e.originalEvent.dataTransfer.setData('offsetX', e.originalEvent.target.width/2 - xo); + e.originalEvent.dataTransfer.setData('offsetY', e.originalEvent.target.height - yo); }); }); -- 2.39.5