bevacqua / dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/dragula/
MIT License
21.89k stars 1.97k forks source link

Animation issue during dragging #555

Closed ar41bald closed 4 years ago

ar41bald commented 6 years ago
  • [x] Bug report

The content of the draggable element is blinking during to dragging. How to reproduce: try to drag the blocks and you should see a blinking https://codepen.io/ar41bald/pen/WMYzLG

This behavior is reproduced on most of the current version of the browsers: Chrome (Ver. 64.0.3282.167), Firefox (52.6.0), IE 11 (11.2068.14393.0)

This occurs because one of the inner DOM element inside mirror contains animation property and it starts each drag event. It's pretty strange because as I can understand from the source code dragula doesn't create a new mirror element for each drag event but use existing one.

My suggestion is to listen all inner animation events and pause them.

carloswbarros commented 5 years ago

The same happens to me, it seems to be creating the same element or adding the same class every time the element is dragged and the animation keeps starting over.

montella1507 commented 4 years ago

@ar41bald @carloswbarros

change getElementBehindPoint funciton in dragula.js to this:

function getElementBehindPoint (point, x, y) {
  var p = point || {};
  var state = p.style.pointerEvents;
  var el;
  p.style.pointerEvents = "none";
  el = doc.elementFromPoint(x, y);
  p.style.pointerEvents = state;
  return el;
}

you can use patchPackage for this..