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

set snap targets for interact('.draggable') from ev.draggable.snap().targets on dropzone dragenter event #151

Closed
askbeka opened this issue Jan 14, 2015 · 2 comments

Comments

@askbeka
Copy link

askbeka commented Jan 14, 2015

Hello, I am a bit confused how to make this work. I have a number of dropzones and draggables and any draggable can be dropped to any dropzone and any of them can swap places with another draggable on enter event. code looks like this:
ondragenter: function(ev) {
interact('.dropped-element').snap({targets: ev.draggable.snap().targets});
}
on debugger I can see that targets for dropped event are changed, but nothing happens. Should I fire some event to make that work? And it says that snap is deprecated on draggable?

@askbeka
Copy link
Author

askbeka commented Jan 14, 2015

Oh.. actually yes I need to move it in order for snap to work. Is there any workaround for this like firing some event after which snap starts working?

@taye
Copy link
Owner

taye commented Jan 15, 2015

Oh.. actually yes I need to move it in order for snap to work. Is there any workaround for this like firing some event after which snap starts working?

No, there's no work easy workaround at the moment. If you try to use the same pointer move event again, it will be ignored. I'll try to get back to you with a decent work around or implement a proper solution soon.

And it says that snap is deprecated on draggable?

interact(target).snap(snapOptions) is deprecated. Snapping is now configured on a per-action basis so you should do:

// set drag snap options
interact(target).draggable({
  snap: snapOptions
});

// get drag snap options
ineract(target).draggable().snap

http://interactjs.io/docs/snapping/

@taye taye closed this as completed in 3489ee1 Nov 9, 2015
taye added a commit that referenced this issue Nov 12, 2015
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

2 participants