-
Notifications
You must be signed in to change notification settings - Fork 777
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
Can't prevent click event after div dragEnd #217
Comments
I would think that this is really more of an Angular issue since interact.js' There's no default action from interact(target).on('click', function (event) {
event.stopImmediatePropagation();
}, true /* useCapture */); |
It's works! You save my day, thanks! .on('dragend', function (event) {
interact(event.target).on('click', function (_event) {
_event.stopImmediatePropagation();
}, true /* useCapture */);
}); |
It's a bad idea to do that on every |
@taye I get Uncaught TypeError: Illegal invocation for stopImmediatePropogation() can you assist? |
@zeeshanjan82 sorry for the late reply. If you didn't sort it out already, a stack trace would be helpful. |
I know this is an old issue, I just wanted to address the adding of the event every *end (resizeend, dragend etc) being a bad idea, simple add the
|
I'm trying to apply this in my React project, did exactly the same as in the comments above and found that it doesn't always work. Since the click after dragging caused by the browser occurs depending on the current position of the cursor and if you go beyond the border of the browser, then this is a document. A solution that always works for me is to add a listener to the document or window:
|
@SlyDave and @LobanovAndrey 's solutions are the best ones. These should be documented. These wil not prevent other click event from being triggered on child nodes. |
I use Interact with angular and have ng-click handler on element. Click has called after my dragend event. How I can prevent that? Where I can add
or smth else?
The text was updated successfully, but these errors were encountered: