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

bugfix: select latest base layer when select atlas

parent ddbabded
No related branches found
No related tags found
No related merge requests found
......@@ -117,10 +117,18 @@ export class ViewerStateControllerUseEffect implements OnDestroy {
const templateSpaceId = templateTobeSelected['@id']
const parcellationId = (
templateTobeSelected.availableIn.find(p => !!p.baseLayer) ||
templateTobeSelected.availableIn[0]
)['@id']
const atlasTmpl = atlas.templateSpaces.find(t => t['@id'] === templateSpaceId)
const atlasParcs = atlasTmpl.availableIn
.map(availP => atlas.parcellations.find(p => availP['@id'] === p['@id']))
.filter(fullP => !!fullP)
const atlasParc = atlasParcs.find(p => {
if (!p.baseLayer) return false
if (p['@version']) {
return !p['@version']['@next']
}
return true
})
const parcellationId = atlasParc && atlasParc['@id']
const templateSelected = fetchedTemplates.find(t => templateSpaceId === t['@id'])
if (!templateSelected) {
......@@ -128,7 +136,7 @@ export class ViewerStateControllerUseEffect implements OnDestroy {
message: CONST.TEMPLATE_NOT_FOUND
})
}
const parcellationSelected = templateSelected.parcellations.find(p => p['@id'] === parcellationId)
const parcellationSelected = parcellationId && templateSelected.parcellations.find(p => p['@id'] === parcellationId)
return viewerStateNewViewer({
selectTemplate: templateSelected,
selectParcellation: parcellationSelected
......
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