-
Notifications
You must be signed in to change notification settings - Fork 143
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
More Events #58
Comments
@xcrap Adding more events is on my list for the upcoming releases. |
The problem is, if i Drag more than one element he still fires multiple times, so If I start dragging and move 3 elements and i finish dragging the onSwapEnd will fire 3 times. It was supposed to fire only once because it was still the same drag? So the onSwapEnd is having the same effect of onSwap |
@xcrap in your case, you need to use createSwapy(container, {
swapMode: 'drop'
}) |
@xcrap sorry, I misread your comment. It's strange that it fires three times. It should fire once per dragging session. Does it happen if you try a simple setup? I couldn't reproduce it here. |
Also the onSwapStart fires once as expected. |
@xcrap I found the bug. I'll push the fix soon and let you know! |
@xcrap It should be fixed now in |
Yes I confirm everything working as expected, thanks a lot :) |
Great, thanks! |
I've noticed another issue with this, if you click in a link inside a slot, just clicking the dragging end is also triggered, so there's an issue with that, clicking should not be considered dragging. Also if you drag but make no order change there should be something that warns about it. The clicking I think it's a bug, the drag but no change it's a suggestion :) |
@xcrap I've just released v0.4.0, which includes:
swapy.onSwapEnd(({ data, hasChanged }) => {
console.log(hasChanged);
console.log('end', data);
}) Thanks for the suggestion :) |
That's really cool, already updated the the click but not dragging is working great, however about the hasChanged I don't think it's making what's supposed to be, because if I drag a item to another position and drag it back to the same and then release the mouse he will return true which should actually be false because they're in the same positions :) Thanks for the updates, really great lib! |
Still in the back issue, I mean "indicate whether any items were swapped", they are swapped, but I think it would be more useful if you they are actually changed/updated :) |
@xcrap good catch! It should be fixed now in |
Oh yeah it's working like a charm and it's very useful while dealing with database updates is nothing happens, great add on thanks a lot for your work, this update and the onSwapEnd has saved me dozens of requests! Life saving :) |
Thank you so much for your kind words :) |
It would be good to have an even only on dragend or something, this way the requests to update the image order to my database would be much smoother instead of every single element switch :)
The text was updated successfully, but these errors were encountered: