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

[FEATURE] Better touch rotation for perspective projection #1688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kurtil
Copy link
Contributor

@Kurtil Kurtil commented Oct 4, 2024

Touch rotation is currently bound to magic numbers (1 for full horizontal rotation and 1.5 for half vertical rotation).

This PR change the way rotateDeltaY and rotateDeltaX are computed. The new computation is based on the x and y axis fov and the canvas aspect ratio. Doing so, the touch rotation in perspective projection behaves more like what is it done on other viewers like Autodesk, Catenda and Dalux (it is possible to test with free demo data on the last one).

The rotation behavior is described as follows:

CorrectTouchRotation.mov

(video recorded using the mouse but the code is for touch handler ONLY)

When you touch a specific area on the model and then rotate, the finger stays above the previously touched area. The touched area follows the finger (minus some perspective distortion on the canvas edges).

To prevent breaking changes and still get the expected behaviour, the configs.dragRotationRate must be set to -360, the opposite as the default value 360. I did not change this default value of 360 and it is handled in the new code, when divided by 360 when computing dx and dy.

NB: touch rotation is changed in this PR for perspective projection ONLY. For the other projections, the behavior is kept the same as before.

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.

1 participant