angular-dragon-drop icon indicating copy to clipboard operation
angular-dragon-drop copied to clipboard

Added btf-eliminate

Open cesarandreu opened this issue 12 years ago • 4 comments

btf-eliminate makes it so that the element is eliminated if it is dropped outside of a dragon.

cesarandreu avatar Jul 29 '13 20:07 cesarandreu

thanks for the PR. I'll try to take a look at it later. :)

btford avatar Jul 29 '13 23:07 btford

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.

cesarandreu avatar Jul 30 '13 00:07 cesarandreu

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
});

xvaldetaro avatar Jul 31 '13 13:07 xvaldetaro

Thanks for the suggestion, I added it as you suggested. It works a lot better and it feels a lot more fluid now!

cesarandreu avatar Jul 31 '13 22:07 cesarandreu