In the sample source 2024.3.0, when user clicks the layer item in the model browser, it will trigger selectLayer API which trigger a clear selection and layer related nodes selection.
In LayersTree.js and TreeControl.js, I notice that when the latter selection triggers the selectionArray callback, the getSelectedLayers is still empty. So I would like to know if there is callback will be triggered when the getSelectedLayers reflects the actual situation?
I guess the async execution of _updateTreeSelectionHighlight in _doSelection in TreeControl.js is for handling my question.
// LayersTree.js
...
selectionArray: (events) => {
if (this._layerNames.length === 0) {
return;
}
this._tree.updateSelection(events);
...
}
// TreeControl.js
_doSelection(...) {
this._selectionLabelHighlightTimer.set(30, () => {
const selectionIds = this._viewer.selectionManager.getResults().map((item) => item.getNodeId());
this._updateTreeSelectionHighlight(selectionIds);
});
}
_updateLayerTreeSelectionHighlight(...) {
...
this._selectedLayers = this._viewer.selectionManager.getSelectedLayers();
}
Thank you