-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handle zoom while camera change #492
Conversation
for more information, see https://pre-commit.ci
Integration tests repot: appsharing.space |
Preview PR at appsharing.space |
@@ -1323,12 +1324,17 @@ export class MainView extends React.Component<IProps, IStates> { | |||
const width = this.divRef.current?.clientWidth || 0; | |||
const height = this.divRef.current?.clientHeight || 0; | |||
|
|||
const distance = position.distanceTo(target); | |||
const zoomFactor = 1000 / distance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why we need this magic 1000
number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of an arbitrary number after some hit and trials, I noticed that more you zoom the object in PerspectiveCamera
more further it goes on OrthographicCamera
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it meant that the distance was inversely proportional to the zooming in that i needed to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I tested on my side and this seems to work well. We have other magic numbers in JupyterCAD
zoom.mov
Shall fix #483