angular-dragon-drop
angular-dragon-drop copied to clipboard
Added btf-eliminate
btf-eliminate makes it so that the element is eliminated if it is dropped outside of a dragon.
thanks for the PR. I'll try to take a look at it later. :)
This new commit is for the specific need I have, and I'm not sure if I'm doing things the angular way or how useful it'd be for other people. It just makes it so that there's a delay when you click on it. I'm not even sure why it showed up here, sorry about that.
I think that the eliminate behavior is very useful. I even made it the default behavior in my project. About the delay, I also think that immediately triggering a drag event is usually confusing, specially if the draggable has another behaviour triggered when clicked. However, instead of adding a delay, I changed triggering drag event to a mousedown+mousemove event instead of the current mousedown only. This way, there is no delay needed.
i.e. instead of :
elt.bind('mousedown', function (ev) {
if (dragValue) {
return;
}
mouseReleased = false;
setTimeout(function(){
... dragging commands
},delay);
});
do something like:
elt.bind('mousedown', function (ev) {
mouseReleased = false;
});
elt.bind('mousemove', function (ev) {
if(dragValue||mouseReleased) {
return;
}
... dragging commands
});
Thanks for the suggestion, I added it as you suggested. It works a lot better and it feels a lot more fluid now!