Conversation
Squareys
left a comment
There was a problem hiding this comment.
This will be such a nice component!
d54b8ab to
ffddab3
Compare
xr-active-switch.ts
Outdated
| * that depend on XR session states. | ||
| * | ||
| */ | ||
|
|
There was a problem hiding this comment.
Superfluous newline here
xr-active-switch.ts
Outdated
| const mode = this.scope; | ||
|
|
||
| // Handle current object | ||
| if (mode === 0 || mode === 2) { |
There was a problem hiding this comment.
Maybe either add comments like 0 /* this object */, or an enum, such that this reads mode == Scope.ThisObject
There was a problem hiding this comment.
That enum can also be exported and this.scope can be typed to it (I think), such that people can easily add them at runtime and just this.object.addComponent('xr-active-switch', {scope: Scope.ThisObject, ifInXR: Action.Activate});
There was a problem hiding this comment.
Ah, there it may make sense to make the defaults Action.Keep, since the most sensible default is that leaving out an explicit configuration just does nothing.
There was a problem hiding this comment.
And maybe we call it Action.None? That's a bit clearer than Keep, also for the enum value 'none'
d4564c6 to
0db127f
Compare
0db127f to
41cddfb
Compare
41cddfb to
eb956da
Compare
| private processChildren(obj: Object3D) { | ||
| for (const child of obj.children) { | ||
| child | ||
| .getComponents() |
There was a problem hiding this comment.
getComponents(XrActiveSwitch.TypeName) already achieves the filtering
| } | ||
|
|
||
| private applyAction(action: Action) { | ||
| this.collectComponents(); |
There was a problem hiding this comment.
Since you only use them here, no need to store on the class:
processChildren(obj: Object3D, out: Component[]) {
// Push into `out`
}
collectComponents() {
const components = [];
processChildren(..., components);
return components;
}components is only temporary, doesn't need to live in the class
No description provided.