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

Remove optionalTarget: Clean up #13522

Merged
merged 1 commit into from
Mar 9, 2018
Merged

Remove optionalTarget: Clean up #13522

merged 1 commit into from
Mar 9, 2018

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Mar 7, 2018

Some clean up to avoid warnings...

@@ -278,15 +278,21 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy

center: function () {

this.computeBoundingBox();
Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, this change can break user code if they did this:

var center1 = geometry1.center();
var center2 = geometry2.center();

Copy link
Collaborator Author

@Mugen87 Mugen87 Mar 7, 2018

Choose a reason for hiding this comment

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

Oh, I see. I guess we have to create a new object in center().

Copy link
Owner

Choose a reason for hiding this comment

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

For now, yeah...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, changed the code.

@WestLangley
Copy link
Collaborator

@mrdoob @Mugen87 The problem with the code is .center() should return this. The method is not .getCenter().

I suggest making that change, even though it is breaking, because the code is incorrect. Then the changes @Mugen87 made previously are fine.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 7, 2018

I suggest making that change, even though it is breaking, because the code is incorrect.

Yeah, sounds reasonable.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 7, 2018

I've only found one example (css3d_molecules.html) where the return value of .center() was used.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 8, 2018

BTW: .center() does not actually return the center but the offset that is used to translate the geometry to the center of the AABB. That's weird and i think the change clarifies the method.

var offset = geometryAtoms.center();
geometryBonds.translate( offset.x, offset.y, offset.z );
geometryAtoms.center();
geometryBonds.center();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does that produce the same offset for both atoms and bonds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The visual result is the same.

BTW: I've missed webgl_loader_pdb. Applied the same change there, too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry. How you can center the atoms and bonds separately makes no sense to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess that works because PDBLoader builds both geometries from the same vertex data.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would inline the center() code, if you have to, and not rely on that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay 😇

@WestLangley
Copy link
Collaborator

Please file API changes in a separate PR.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 8, 2018

Okay, i undo the change to .center() in Geometry and BufferGeometry.

@WestLangley
Copy link
Collaborator

Thanks... Not to derail, but do you know how to collapse these commits into a single 'Remove optionalTarget: clean up' commit, so all the intermediary changes -- and reverted changes -- do not appear in the file commit history?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 8, 2018

Okay, i made a force push. The old commits are now gone. I also inlined the code in the PDB examples. Hope, it's now okay like that 😅

@mrdoob mrdoob added this to the r91 milestone Mar 9, 2018
@mrdoob mrdoob merged commit 57a3888 into mrdoob:dev Mar 9, 2018
@mrdoob
Copy link
Owner

mrdoob commented Mar 9, 2018

Thanks!

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.

3 participants