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

Controls: Require element in connect() #30772

Merged
merged 1 commit into from
Mar 21, 2025
Merged

Controls: Require element in connect() #30772

merged 1 commit into from
Mar 21, 2025

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Mar 21, 2025

Description

Finally found some time to implement #29079 (comment).

This PR changes this recent API (1):

const controls = new THREE.OrbitControls( camera );
controls.domElement = element;
controls.connect();

To this (2):

const controls = new THREE.OrbitControls( camera );
controls.connect( element );

This API still works (3):

const controls = new THREE.OrbitControls( camera, element );

@Mugen87 Not sure if there's a way of not breaking the (1) version?

@mrdoob mrdoob added this to the r175 milestone Mar 21, 2025
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.08
78.29
336.08
78.29
+0 B
+0 B
WebGPU 525.21
146.28
525.21
146.28
+0 B
+0 B
WebGPU Nodes 524.67
146.18
524.67
146.18
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.15
112.18
465.15
112.18
+0 B
+0 B
WebGPU 598.01
162.57
598.01
162.57
+0 B
+0 B
WebGPU Nodes 553.1
152.04
553.1
152.04
+0 B
+0 B

@mrdoob mrdoob merged commit db72336 into dev Mar 21, 2025
12 checks passed
@mrdoob mrdoob deleted the controls branch March 21, 2025 07:51
@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 21, 2025

Not sure if there's a way of not breaking the (1) version?

I don't think so. But given the new warning I think the migration task is obvious.

I've also added the change to the migration guide for r175.

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