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

How to get current position of dragend? #541

Closed Lanseer closed 3 years ago

Lanseer commented 6 years ago

Please only use GitHub issues for bug reports and feature requests.

  • [ ] Read the contributing guidelines
  • [ ] Bug reports containing repro steps are likely to be fixed faster
  • [ ] Feature requests should be multi-purpose, describe use cases
  • [ ] For support requests or questions, please refer to our Slack channel
Lanseer commented 6 years ago

dragulaService.dragend.subscribe((value) => { let [el, target, source] = value.slice(1); var rect = el.getBoundingClientRect().top; console.log(rect.top); console.log(el); console.log(target); console.log(source); }); the log is the original position of el,I need get current position when dragend occurred,anyone can help me ,thx in advance!

phamtienmanh commented 6 years ago
  let dragEl = value[1];
  let list = Array.prototype.filter.call(value[1].parentNode.childNodes, (node) => {
    return node.tagName === 'TR';
  });
  this.newIndex = list.findIndex((node) => {
    return node === dragEl;
  });