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

Layers methods return this #30643

Open
dipterix opened this issue Mar 4, 2025 · 1 comment
Open

Layers methods return this #30643

dipterix opened this issue Mar 4, 2025 · 1 comment

Comments

@dipterix
Copy link

dipterix commented Mar 4, 2025

Description

Currently Layers.set is

	set( layer ) {
		this.mask = ( 1 << layer | 0 ) >>> 0;
	}

Would it be nice to return this so just like Vector3:

layerA.test( new Layers().set(2) );

Solution

For all the methods possible,

	set( layer ) {
		this.mask = ( 1 << layer | 0 ) >>> 0;
        return this;
	}

Alternatives

N/A

Additional context

No response

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 4, 2025

The methods in three.js only return this if there is a high chance that the method invocations will be chained which is typical for math classes.

I'm not sure this is true for Layers. However, this is somewhat a subjective call so it would interesting to hear the opinion of others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants