Improve vertical collision item swapping #2070
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR aims to improve vertical collision item swapping by making items swap in the layout once it's position in the layout is past the midpoint of the colliding item. As mentioned in #2053, when dragging smaller layout items over larger ones, the smaller item needs be way past the midpoint of the bigger element for them to actually swap (See video below)
rgl-collision-detection-movement.mp4
This creates an undesired / inconsistent experience when trying to swap to elements in the layout vertically.
In this PR I adjusted the collision movement logic to swap the elements once the colliding element is halfway past the midpoint of the other layout item. Collision movement after these changes:
rgl-vertical-collision-movement-impovement.mp4
This PR [adds/removes/fixes/replaces] the [feature/bug/etc].
What type of PR is this? (check all applicable)
Related Tickets & Documents
Fixes #2053
Mobile & Desktop Screenshots/Recordings
Added tests?
Added to documentation?