Avoid swapChildren and swapChildrenAt
08.08.18Simply googling for the phrase 'flex RangeError swapChildrenAt' returns enough reason to follow this advice. Here's some pseudo-code that does work for swapping the depth of two children, A and B:
- A needs to be at a depth above B. If not, then switch references to A and B in the following points.
- Remember the depths of A and B
- Remove A
- Remove B
- Add A to the level where B was
- Add B to the level where A was