You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common programming idiom is to call add() when the object (interactive) is created, and then call remove() when the object is destroyed.
However, due to the lack of understanding of the source code details, if the name field of the object is not assigned, it will cause all objects called remove() to be removed.
remove(){if(!object)return;constfilterSet=newSet<string>(childNames.length>0 ? childNames : [object.name]// If `name` is `undefined` ?);this.interactiveObjects=this.interactiveObjects.filter((o)=>!filterSet.has(o.name)// If `name` is `undefined` ?);}
So, if I understand correctly, the name field value of a 3D object should be unique? If yes, is this critical and should it be specifically mentioned in the docs?
The text was updated successfully, but these errors were encountered:
Hi @wang1212, thank you for pointing this out. There was indeed a bug in the remove function. The intention was not to make object.name mandatory. I just published release 1.7.0, which fixes this. Now all objects, whose name is undefined won't be removed when calling InteractionManager.remove(...) with an object whose name is undefined.
A common programming idiom is to call
add()
when the object (interactive) is created, and then callremove()
when the object is destroyed.However, due to the lack of understanding of the source code details, if the
name
field of the object is not assigned, it will cause all objects calledremove()
to be removed.https://github.com/markuslerner/THREE.Interactive/blob/v1.6.1/src/index.ts#L223
So, if I understand correctly, the
name
field value of a 3D object should be unique? If yes, is this critical and should it be specifically mentioned in the docs?The text was updated successfully, but these errors were encountered: