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

Drag-dropping a node in the same position and container no longer rem… #485

Merged
merged 1 commit into from Jul 8, 2015

Conversation

StefanCodes
Copy link
Contributor

The drag-drop apply function in its current form removes an element from its collection and then re-inserts it in its final place. This is normally fine, except when dragging and dropping a node into the same place. In this case, the node hasn't moved, but removing and reinserting the node can have side effects.

In my use case, we're using another library (BreezeJs) to perform automatic change detection. When dropping a node without moving, this causes simply clicking a draggable node to trigger change detection and improperly identify the node as changed.

This PR checks if the node is being dropped into the same container and index as it started in, and then returns without manipulating the node's place in its collection.

…oves and re-adds it to its parent node array
@Voles
Copy link
Member

Voles commented Jul 8, 2015

Thanks for your contribution! I've tested this locally, looking good. 👍

Voles pushed a commit that referenced this pull request Jul 8, 2015
Drag-dropping a node in the same position and container no longer rem…
@Voles Voles merged commit 1da5b9d into angular-ui-tree:master Jul 8, 2015
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.

None yet

2 participants