Skip to content
Snippets Groups Projects
Commit 732a8b6f authored by Xiao Gui's avatar Xiao Gui
Browse files

bugfix: race cond setting layer vis

parent 8d426735
No related branches found
No related tags found
No related merge requests found
......@@ -303,13 +303,15 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
this.ondestroySubscriptions.push(
this.layerVis$.pipe(
switchMap(switchMapWaitFor({ condition: () => !!(this.nehubaViewer?.ngviewer) })),
tap(() => {
const managedLayers = this.nehubaViewer.ngviewer.layerManager.managedLayers
managedLayers.forEach(layer => layer.setVisible(false))
}),
debounceTime(160),
).subscribe((layerNames: string[]) => {
/**
* debounce 160ms to set layer invisible etc
* on switch from freesurfer -> volumetric viewer, race con results in managed layer not necessarily setting layer visible correctly
*/
const managedLayers = this.nehubaViewer.ngviewer.layerManager.managedLayers
managedLayers.forEach(layer => layer.setVisible(false))
for (const layerName of layerNames) {
const layer = this.nehubaViewer.ngviewer.layerManager.getLayerByName(layerName)
if (layer) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment