taye / interact.js

JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+)

Home Page:http://interactjs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unset no longer working since 1.10.12

caitcif opened this issue · comments

If you have questions about the API that aren't answered in the docs or FAQ, try asking in the Gitter chatroom or on Stackoverflow.

If you've found something that looks like a bug, include a link to a minimal demo on JSFilddle, Codepen with instructions to reproduce the bug with and roughly follow the following issue description format:

Expected behavior

Tell us what should happen

I have been using 1.10.11 for a while and updated to the latest version and unset no longer removes my interactables from the list leading to duplicates. The issue happens from version 1.10.12 were unset was modified.

1.10.11

  unset (this: InteractableBase) {
    super.unset()
    scope.interactables.list.splice(scope.interactables.list.indexOf(this), 1)

    scope.fire('interactable:unset', { interactable: this })
  }

1.10.12

  unset (this: InteractableBase) {
    super.unset()

    const index = scope.interactables.list.indexOf(this)
    if (index < 0) return

    super.unset()
    scope.interactables.list.splice(index, 1)
    scope.fire('interactable:unset', { interactable: this })
  }

Actual behavior

Tell us what happens instead

when I run the code step by step in 1.10.12 the code jumps over the splice call. I have no idea why but it makes the code no longer work.

System configuration

interact.js version:
1.10.11 to 1.10.12
Browser name and version:
Chrome
Operating System:
Windows 10