Fixes bumping too much when in RTL #2360
Merged
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.
The basics
The details
Resolves
#2290
Proposed Changes
Previously we were just taking the negative value of dx when in RTL. As far as I can tell this only works the first time that we bump a block. The next times that we bump a block the x value of the output connection is farther to the left(because of the previous bump) while the place that we want to get to (staticConnection.x_ + snap_radius + random number) is moving farther to the right. So when we take the different between the two it is getting larger and larger creating the unnecessarily large bump.
The proposed fix is to change subtract the snap_radius and random number instead of adding them. This way our target is in the same direction as the block is moving. Which will create a smaller bump.
Reason for Changes
Some blocks in RTL were getting bumped too far.
Test Coverage
Tested on:
Desktop Chrome
Additional Information