collision: more edge case fixes#1663
Merged
Merged
Conversation
fix gridstack#1094 * found I needed to take entire row (not just new location) when doing collision to correctly push down bottom items first so they keep their order and prevent large objects from leapfrogging smaller ones. (like old code used to do) * removed _beforeDrag and _packY fields and re-use existing _orig position data which simplifies things * removed yOffset during _fixCollisions() as it was incorrect (reverse sorting should take care of that) * on _leave() of external item, we now restore all items to original position using restoreInitial() (prevents any error from sticking) NEEDLESS to say, this is MUCH more complicated than the old _fixCollision() that moved to new loc then pushed anything down in that row and below (bottom first) which is dead simple... but required you to move 90% past the item when moving down.
|
Thank you soo much for you hard work! I really, truly appreciate it and wish more people could donate to reward your continued effort. I'm just really glad you took the time to do this :) |
Member
Author
|
@Prid13 thank you for the comment. Would be great if you would follow on that donation. I've been thinking of making this commercial version as it take a huge amount of time and very few do contribute. |
|
I've already donated a while back but will try donating a bit more (won't be as much, unfortunately) :) I'm thinking of using this in a commercial product myself and will be sure to donate more if I ever manage to turn a profit on it :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
fix #1094
(like old code used to do)
NEEDLESS to say, this is MUCH more complicated than the old _fixCollision() that moved to new loc then pushed anything down in that row and below (bottom first) which is dead simple... but required you to move 90% past the item when moving down.
Checklist
yarn test)