Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between v1.3.0 and v1.2.9 #560

Closed
steveHornseyDeveloper opened this issue Nov 27, 2017 · 2 comments
Closed

Inconsistency between v1.3.0 and v1.2.9 #560

steveHornseyDeveloper opened this issue Nov 27, 2017 · 2 comments

Comments

@steveHornseyDeveloper
Copy link

I've found an inconsistency between Interact.js v1.3.0 and v1.2.9.

I've created the following codePen which illustrates the issue:
https://codepen.io/steveHornseyDev/pen/VrGjXP
It is based off an example on http://interactjs.io/ and in v1.2.9 it works fine and in v1.3.0 it is broken

Expected behavior

The draggable onend fires. Then the dropzone ondrop fires.

Actual behavior

The draggable onend calls draggableElem.unset() which seems to prevent the dropzone ondrop from firing in v1.3.0 only.

If .unset() is not called both versions work fine.

In my Production code I am calling .unset() as after an element is dropped as it can no longer be moved. It's an angular application and the draggable element and the dropzone are in different scopes/directives. Do you have any suggestions? Currently as a work around I think my best option is to use an event after dropzone ondrop which calls the correct scope and .unset() (but this seems a bit like a hack).

System configuration

Using Chrome - Version 62.0.3202.94 (Official Build) (64-bit)

@taye taye added this to the v1.3.1 milestone Nov 29, 2017
@taye taye closed this as completed in 79f77d1 Nov 30, 2017
@JulienBier
Copy link

JulienBier commented Jan 18, 2018

I updated interactjs from 1.2.8 to 1.3.3 and it seems that the dropzone.ondrop handler is always called before the the draggable.onend event.
Can you tell me if I'm wrong?
If not, do you have any suggestion to bring back the previous flow?

Thanks

@taye
Copy link
Owner

taye commented Feb 10, 2018

@JulienBier starting in 1.3.3 dragend is fired before drop. To check if a drop happens with the dragend event you can do:

interact(target).on('dragend', event => {
  if (event.dropzone) {
    // you can do what you used to do in the drop listener here instead
    console.log(event.dropzone, event.relatedTarget);
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants