Skip to content

Conversation

@ChargeIn
Copy link
Contributor

Hey, I was trying to fix #933.

What I notices is that the grid starts a recursive chain to pushes all items to the north and once it hit the border it works it self back from the top checking all the other possible solutions -> Leading to Number 1 being pushed down by Number 2 creating the swap effect.

There are multiple solution how this could be solved. E.g. we could track if the push would collide with there chained pushed coming from the opposite direction.

But I was wondering what is the use case for this last check? In the code you are checking for swap in a separate function so there should not really be a need to check for a push in the direction you are coming from.

Can you please give a small example? Otherwise the code attach will fix the issue.

I create a patch file to test the issue. After applying you can find the test view under the path "/test"
add_test_view.patch

@tiberiuzuld
Copy link
Owner

Hi @ChargeIn ,
From what I remember the use case for the recursive check of direction of push is that if you have a limited grid, let's say a 4x4 grid limited with maxRows and maxCols. So when one item is moved the other 3 need to spin like a clock around the grid.

Don't think if we make the proposed changes will this corner case still work.

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.

Bug with swapping items

2 participants