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

Added btf-eliminate #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

cesarandreu
Copy link

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

@btford
Copy link
Owner

btford commented Jul 29, 2013

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

… btf-dragon-delay which defaults to zero, but when it's not zero it requires that amount of time to be waited before the element is picked up. This was added because I wanted to make the element clickable.
@cesarandreu
Copy link
Author

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.

@xvaldetaro
Copy link

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

@cesarandreu
Copy link
Author

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

jimschubert referenced this pull request in jimschubert/angular-dragon-drop Jan 22, 2015
Added btf-eliminate

Conflicts:
	dragon-drop.js
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

Successfully merging this pull request may close these issues.

3 participants