Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the issues when parent element has a CSS scale transform applied to it #123

Merged
merged 1 commit into from Nov 29, 2018
Merged

Fix for the issues when parent element has a CSS scale transform applied to it #123

merged 1 commit into from Nov 29, 2018

Conversation

rathodsanjay
Copy link
Contributor

This is a fix for the issue: #31 - when the parent of the element which is being dragged has a CSS scale transform applied to it, the element and the cursor become de-synced.

The issue is fixed by dividing the translated X and Y coordinates by the scale. However this also needed some changes to be made to the old coordinates (oldTrans) in order to prevent the element from bouncing off in some scenarios.

let temp = this.currTrans.value;
temp.x = temp.x * this.scale;
temp.y = temp.y * this.scale;
this.oldTrans.set(new Position(temp.x, temp.y));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xieziyu - you may want to optimize this block or may have a better approach for it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it's great. Thanks.

@xieziyu xieziyu merged commit 700c271 into xieziyu:dev Nov 29, 2018
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.

None yet

2 participants