Closed artaommahe closed 6 years ago
Looks like removing listeners from document
breaks interact and he cant add them one more time after unset
.
Try updating to v1.4.0-alpha
and using interact.removeDocument(document)
. Calling interact(anyTarget)
again adds the document back or you can do interact.addDocument(document)
.
@taye it works, thx
@taye Is there anything in the doc that say something about this whole process? I have lost some hours while trying to solve a bug with react-router-dom and interactjs, which was caused by many event listeners. The problem was that on second time I tried to move a draggable item ( after leaving the screen and comming back ) the item was moved twice the distance. If there is no section about this in the doc, it would be nice if someone write about it ( I may do it my self if you ask).
After calling on single interact instance
there are still document listeners like
pointermove
that were not cleaned up, they work on every page despite interact usage. It's huge slowdown for SPA and slow PC/IE11. (mouse move on empty area with 4x slowdown on dev pc)After some debugging i found that i need to call manually
But this will not work due to error on this line (wrong
on
prefix) https://github.com/taye/interact.js/blob/master/src/utils/events.js#L88 while when we add listeners there is noon
prefix https://github.com/taye/interact.js/blob/master/src/utils/events.js#L53 After removing this prefix everything works fine. So there is 2 problemsdocument
listeners cleanup (mb lib should check that there is no other interact instances and cleanup this listeners)