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

Element Drag Helper - Screen to Local gives wrong values if parent is scaled #4935

Merged
merged 1 commit into from Dec 19, 2022

Conversation

yaustar
Copy link
Contributor

@yaustar yaustar commented Dec 19, 2022

Fixes #4934

_screenToLocal was using localPosition which meant if the parent of the element is scaled and not at 0, 0, 0 (which is the case for most 3D screens where the default is 0.01 scale), the plane position would be in the wrong position

Then the calculated intersection would be incorrect and the local Z value would change

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@yaustar yaustar self-assigned this Dec 19, 2022
@willeastcott
Copy link
Contributor

Nice fix! 👍

@yaustar yaustar merged commit 7fd1e52 into main Dec 19, 2022
@yaustar yaustar deleted the world-space-scroll-view-fix branch December 19, 2022 14:23
@kungfooman
Copy link
Collaborator

Please reconsider, this should break #3748 again

@yaustar
Copy link
Contributor Author

yaustar commented Dec 19, 2022

Confirmed it does break #3748 again which leaves us in a problem. I will investigate more

@yaustar yaustar restored the world-space-scroll-view-fix branch December 19, 2022 15:26
@yaustar
Copy link
Contributor Author

yaustar commented Dec 19, 2022

@kungfooman The current fix I can think of for both issues is to 0 out the local Z position from _screenToLocal

Test projects:
https://playcanvas.com/project/1020980/overview/scroll-view-doesnt-work-in-world
https://playcanvas.com/project/856038/overview/dragging-in-world-space-issue

See: c72be6a

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.

Scroll View in 3D Space does not scroll correctly
4 participants