reppners / ngx-drag-drop

Angular directives using the native HTML Drag And Drop API
https://reppners.github.io/ngx-drag-drop/
BSD 3-Clause "New" or "Revised" License
307 stars 120 forks source link

Cleanup on destroy #67

Closed andreroggeri closed 5 years ago

andreroggeri commented 5 years ago

Describe the bug If the directive is destroyed before the dragend event, it stays on a invalid state. For example, anything can be dragged to a dropzone because the current state is still dragging. I believe that calling the endDrag method on destroy should fix this issue To Reproduce If possible please provide a StackBlitz based on this template https://stackblitz.com/edit/ngx-drag-drop-destroy-cleanup?file=src/app/app.component.html

Steps to reproduce the behavior:

  1. Try to drag the title of the page to the basket
  2. Drag a element from the market to the basket
  3. Repeat step 1 and check the console.

Expected behavior It should not allow to drag elements that are not draggable (Only in case of dndAllowExternal=true) and no error should occur on console Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

reppners commented 5 years ago

Welcome and thanks for the thorough bug report!

Good catch 👍 fixed with 2.0.0-rc.7

andreroggeri commented 5 years ago

Great! 😁 Any chance of this being ported to 1.x.x versions?

I can't use alpha/beta/RC packages on my company 😔

reppners commented 5 years ago

Sure, v1.1.1 it is 😃

reppners commented 5 years ago

But you can use v2.0.0 as well because it's out now as stable.