I am using Hoops Communicator 2024.03. In the Model Browser Layers Tab of the demo application, when I use setSelectionFilter, toggle the layer item has different event number in the selectionArray callback event.
// when bodyInstance node is select, I force it to select PartInstance
this._viewer.selectionManager.setSelectionFilter((nodeId) => {
if (this._viewer.model.getNodeType(nodeId) === NodeType.BodyInstance) {
return this._viewer.model.getNodeParent(nodeId);
}
return nodeId
})
// LayersTree.js
// By passing the same layerName with SelectionMode.Toggle, if selectionFilter is used
// For adding nodes of the layer, the SelectionArray callback event will have size more than thousand
// For remove nodes of the layer, the SelectionArray callback event will have size less than thousand
// But if the selectionFilter is commented, the event will have the same size for both add and remove situation
_selectLayer(layerId, selectionMode) {
const layerName = TreeGetLayerName(layerId);
if (layerName !== null) {
this._viewer.selectionManager.selectLayer(layerName, selectionMode);
}
}
So I would like to know if this is expected behavior? Thank you.
For the event number I mean the size of selectionArray callback argument.
// for example, the size of events
selectionArray: (events) => { ... }
So what I encountered is the size of events is different when calling selectLayer with SelectionMode.Toggle and selectionFilter. In other word, the nodes are selected and the nodes are removed by the selectLayer function is different when selectionFilter is used.
The issue I encountered is when I select nodes of the layer (Add ) it has 1857 nodes selected. When I deselect the nodes of the layer (using Toggle mode), it has 440 nodes from the callback.
This is the API I used. Given that when the layerName is not selected, SelectionMode.Set is used. If the layerName is selected, SelectionMode.Toggle is used.
For the selectionArray screenshot, the layerName are the same for both Set and Toggle case.