Skip to content

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

Merged
Voles merged 1 commit into
angular-ui-tree:masterfrom
resiliencesw:master
Jul 8, 2015
Merged

Drag-dropping a node in the same position and container no longer rem…#485
Voles merged 1 commit into
angular-ui-tree:masterfrom
resiliencesw:master

Conversation

@StefanCodes

Copy link
Copy Markdown
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

Voles commented Jul 8, 2015

Copy link
Copy Markdown
Member

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.

2 participants