Fix: Blocks shifts by the border's size when removed or debug mode enabled #17
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.
Problem
Blocks move right little by little when hit by the ball. It's not a problem when the number of blocks is small, but when the document contains many inline elements aligned in a block element, the rightmost element shifts significantly.
Here's an example reproduced by the
controlMode: "mouse"feature created in #15, and hard-codingvisualizeBlocks: false(checkout my debug branch if you reproduce by yourself):As you can see, several right blocks shift so right that the ball breaks them without colliding. This is because the shifts make their actual positions differ from the positions managed by the game.
The source of the screenshot HTML is here.
Solution
Use
outlineinstead ofborderfor highlighting block hit by the ball (or when debug mode).NOTE
I tested this change only in the example case and my website's top page. Tell me if you think of any side-effect.