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

Zooming to cursor position in OrbitControls #24979

Closed
wants to merge 1 commit into from

Conversation

allala0
Copy link

@allala0 allala0 commented Nov 17, 2022

Related issue: #17145 and #18202

Proposing solution for zooming to mouse cursor/mobile touch pinch position in OrbitControls.

Working both for PerspectiveCamera and OrthographicCamera.
Working for both OrbitControls and MapControls.
Working both for mouse and touch events.
Working with and withount damping enabled.
No problem with division by 0.

To enable zooming to cursor: controls.enableZoomToCursor = true, default is false.

@@ -25,6 +25,9 @@ class OrbitControls extends EventDispatcher {

super();

if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' );
if ( domElement === document ) console.error( 'THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.' );
Copy link
Collaborator

@Mugen87 Mugen87 Nov 18, 2022

Choose a reason for hiding this comment

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

Something is not right with this PR. You are adding unrelated changes. Consider to rebase your branch. Besides, please do not modify examples/js/controls/OrbitControls.js.

@allala0 allala0 closed this Nov 18, 2022
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.

2 participants