Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
when using offsetX/Y, check if jQuery is available. If so, read from …
Browse files Browse the repository at this point in the history
…event.originalEvent
  • Loading branch information
Jason Shaev committed Mar 1, 2016
1 parent 99e649f commit ec69adf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lrDragNDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@
dropIndex, i, l;
if (item !== null) {
dropIndex = scope.$index;
dropIndex = isAfter(evt.offsetX, evt.offsetY) ? dropIndex + 1 : dropIndex;
var offsetX = window.jQuery ? evt.originalEvent.offsetX : evt.offsetX;
var offsetY = window.jQuery ? evt.originalEvent.offsetY : evt.offsetY;
dropIndex = isAfter(offsetX, offsetY) ? dropIndex + 1 : dropIndex;
//srcCollection=targetCollection => we may need to apply a correction
if (collectionCopy.length > collection.length) {
for (i = 0, l = Math.min(dropIndex, collection.length - 1); i <= l; i++) {
Expand All @@ -167,7 +169,9 @@
element.bind('dragover', function (evt) {
var className;
if (store.isHolding(key)) {
className = isAfter(evt.offsetX, evt.offsetY) ? 'lr-drop-target-after' : 'lr-drop-target-before';
var offsetX = window.jQuery ? evt.originalEvent.offsetX : evt.offsetX;
var offsetY = window.jQuery ? evt.originalEvent.offsetY : evt.offsetY;
className = isAfter(offsetX, offsetY) ? 'lr-drop-target-after' : 'lr-drop-target-before';
if (classCache !== className && classCache !== null) {
element.removeClass(classCache);
}
Expand All @@ -181,4 +185,4 @@
}
};
}]);
})(angular);
})(angular);

0 comments on commit ec69adf

Please sign in to comment.