Skip to content

Conversation

@Methuselah96
Copy link
Contributor

Related issue: N/A

Description

As far as I can tell, passing an HTML element in an Object3D constructor doesn't do anything.

bond.style.height = bondLength + 'px';

const joint = new THREE.Object3D( bond );
const joint = new THREE.Object3D();
Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as I can tell, passing an HTML element in an Object3D constructor doesn't do anything.

Good catch! However, bond is later used in the code to create another instance of CSS3DObject. And it's not right that multiple objects share the same DOM element. So please restore the bond creation and just remove the parameter from the ctor call of Object3D.

Copy link
Contributor Author

@Methuselah96 Methuselah96 Mar 1, 2023

Choose a reason for hiding this comment

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

🤦 Indeed. I moved the creation of the new bond element closer to its usage if that's okay.

@Methuselah96 Methuselah96 force-pushed the examples-css3d-molecules-cleanup branch from 6c859b4 to fe98e9a Compare March 1, 2023 12:13
@Methuselah96 Methuselah96 changed the title Cleanup unused code in css3d_molecules example Cleanup code in css3d_molecules example Mar 1, 2023
@Mugen87 Mugen87 added this to the r151 milestone Mar 1, 2023
@Mugen87 Mugen87 merged commit d2c88a0 into mrdoob:dev Mar 1, 2023
@Methuselah96 Methuselah96 deleted the examples-css3d-molecules-cleanup branch March 1, 2023 12:25
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