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

Terminate dragging without a drop #26

Closed
lazylester opened this issue Oct 9, 2018 · 3 comments
Closed

Terminate dragging without a drop #26

lazylester opened this issue Oct 9, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@lazylester
Copy link
Contributor

In using sl-vue-tree in my app, I have concluded that it's sometimes necessary to terminate dragging without dropping the draggingNodes anywhere. Sometimes I have inadvertently found dragging to be triggered and there's currently no way to terminate it. In another scenario, I initiate dragging but then change my mind, and I would just like to revert to the pre-dragging hierarchy.

I would happily submit a PR for this, but would like to understand if

  1. you agree that it's desirable
  2. you have a preference as to how it should be done, options I can think of (you may have other ideas too) include:
    a) hit the keyboard escape key
    b) drop the dragging nodes left or right of the bounding box
    c.) drop the dragging nodes above or below the bounding box, sufficiently far removed that it's not interpreted as a drop 'before' the first node or 'after' the last node.
@holiber
Copy link
Owner

holiber commented Oct 9, 2018

Hi. That's a good proposal. I like the idea to have an ESC key to cancel the dragging by default. However, the key should be customizable. The closest PR for adding a new key handler is #13 . Other options are good too, but not for the default behavior.

@holiber holiber self-assigned this Oct 9, 2018
@holiber holiber added the enhancement New feature or request label Oct 9, 2018
@PayteR
Copy link

PayteR commented Oct 12, 2018

Hi, i need this feature, because i want to show confirmation window, where user can cancel dragged item and return it back to previous position. I have idea how to do it, but i can't figure out, how to change path for item, this:

Vue.set(nodeModel, 'path', [9])
slVueTree.updateNode(node.path, { path: [9] })

not work, how can i change path? thx

@holiber
Copy link
Owner

holiber commented Oct 13, 2018

@PayteR if you want to rollback last dragging try to check out the solution here #12

@holiber holiber closed this as completed Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants