From c3c4d41d88582e8da37bb13d819d848739fe97bb Mon Sep 17 00:00:00 2001 From: Nicolas Bevacqua Date: Thu, 25 Feb 2016 15:39:28 -0300 Subject: [PATCH] fixed #14, miscalculation on edges for position candidacy --- changelog.markdown | 4 ++++ dragula.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.markdown b/changelog.markdown index c74ef68c..fc90e56f 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,7 @@ +# 3.6.7 Miscalculation + +- Fixed a long-standing bug where candidate positioning would be off by one position + # 3.6.6 Living on the Edge - Fixed a bug with clicks on IE7, IE8, IE9 diff --git a/dragula.js b/dragula.js index bf28474d..edd32200 100644 --- a/dragula.js +++ b/dragula.js @@ -460,8 +460,8 @@ function dragula (initialContainers, options) { for (i = 0; i < len; i++) { el = dropTarget.children[i]; rect = el.getBoundingClientRect(); - if (horizontal && rect.left > x) { return el; } - if (!horizontal && rect.top > y) { return el; } + if (horizontal && (rect.left + rect.width / 2) > x) { return el; } + if (!horizontal && (rect.top + rect.height / 2) > y) { return el; } } return null; }