Fixed draggable position bouncing when draggable is scaled and position is set #150
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.
Fixed #149
As i fixed this bug for the 1st time by moving the bouncing check up (see my 1st commit) I just didn't really like how the scaling code was implemented (needed isDragged, and bouncing fix), so i mostly rewrote how its calculated. Now it just divides moved pixels with scale, so if we moved the draggable by 1px and the scale is 0.5 then it will set that we moved 1 / 0.5 = 2px, the only problem is that broke the bounds and i had to divide the moved pixels with the scale, but i would suggest to just set the draggable position to bounding box side, not constantly removing the difference between the two.
As I was testing my fix i came across another bug that this PR fixes. Scale and gridSize doesn't work together.
Previously, current master:
Now, pr:
As this isn't so small of a fix and I am afraid that i may have broken something (I tried to test as much as possible, dynamically changing scale, checking if draggable position doesn't change), I would like to ask the scale implementer (@rathodsanjay) to check if I didn't break anything for him.