Skip to content

[BUG] Fix cancel revert with copy and copySortSource#529

Open
PhilBroadbent wants to merge 1 commit intobevacqua:masterfrom
PhilBroadbent:BUG/fix-revert-copy
Open

[BUG] Fix cancel revert with copy and copySortSource#529
PhilBroadbent wants to merge 1 commit intobevacqua:masterfrom
PhilBroadbent:BUG/fix-revert-copy

Conversation

@PhilBroadbent
Copy link
Copy Markdown

@PhilBroadbent PhilBroadbent commented Oct 26, 2017

This PR is to fix a bug relating to calling drake.cancel(true) when using copy: true and copySortSource: true

When copy is false, moving an item within a container and calling cancel with revert: true correct returns the dragged element to the correct position. However, when copy is true (and thus we must also set copySortSource: true else we cannot reorder items in the source container), calling cancel(true) does not return the element to it's original position but instead removes the element.

The fix is to check whether the parent is the same as the source container - if it is, do not remove the element and instead use insertBefore (same as with copy: false), and if it is not, then the element can be safely removed.

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.

1 participant