[FEATURE] Better touch rotation for perspective projection#1688
Open
Kurtil wants to merge 1 commit intoxeokit:masterfrom
Open
[FEATURE] Better touch rotation for perspective projection#1688Kurtil wants to merge 1 commit intoxeokit:masterfrom
Kurtil wants to merge 1 commit intoxeokit:masterfrom
Conversation
Member
|
@Kurtil Sorry for the delay getting to this PR! One thing I'd like to change, if agreeable to you - can we introduce a new flag (with getter/setter) on I think this would be fine for users to get by default! |
Contributor
Author
|
Ok ! I will do that soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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
rotateDeltaYandrotateDeltaXare computed. The new computation is based on thexandyaxisfovand 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.dragRotationRatemust be set to-360, the opposite as the default value360. I did not change this default value of360and it is handled in the new code, when divided by360when computingdxanddy.NB: touch rotation is changed in this PR for perspective projection ONLY. For the other projections, the behavior is kept the same as before.