diff --git a/src/plugin_examples/plugin_api.md b/src/plugin_examples/plugin_api.md index 53794edc11e830ef25f0e98e5820bb2bdf037b43..131e564e47fc8852553f0815d14ce8c23baca2aa 100644 --- a/src/plugin_examples/plugin_api.md +++ b/src/plugin_examples/plugin_api.md @@ -100,7 +100,7 @@ window.interactiveViewer - *remove3DLandmarks(IDs)* removes the landmarks by their IDs ```js window.interactiveViewer.viewerHandle - .remove3DLandmarks(['fzj-xg-jugex-1', 'fzj-xg-jugex-1']) + .remove3DLandmarks(['fzj-xg-jugex-1', 'fzj-xg-jugex-2']) /* removes the landmarks added above */ ``` diff --git a/src/services/state/viewerState.store.ts b/src/services/state/viewerState.store.ts index ce5b4c7f17e249d35c0605ab2168ac91fd6e7b71..a8ff3fdaade1c41dbd7b6f46215f7caabc400526 100644 --- a/src/services/state/viewerState.store.ts +++ b/src/services/state/viewerState.store.ts @@ -45,64 +45,80 @@ export function viewerState( const dedicatedView = state.dedicatedView ? state.dedicatedView.concat(action.dedicatedView) : [action.dedicatedView] - return Object.assign({},state,{ + return { + ...state, dedicatedView - }) + } case UNLOAD_DEDICATED_LAYER: - return Object.assign({},state,{ + return { + ...state, dedicatedView : state.dedicatedView ? state.dedicatedView.filter(dv => dv !== action.dedicatedView) : [] - }) + } case NEWVIEWER: - return Object.assign({},state,{ + return { + ...state, templateSelected : action.selectTemplate, parcellationSelected : action.selectParcellation, regionsSelected : [], landmarksSelected : [], navigation : {}, dedicatedView : null - }) + } case FETCHED_TEMPLATE : { - return Object.assign({}, state, { + return { + ...state, fetchedTemplates: state.fetchedTemplates.concat(action.fetchedTemplate) - }) + } } case CHANGE_NAVIGATION : { - return Object.assign({},state,{navigation : action.navigation}) + return { + ...state, + navigation : action.navigation + } } case SELECT_PARCELLATION : { - return Object.assign({},state,{ + return { + ...state, parcellationSelected : action.selectParcellation, regionsSelected : [] - }) + } } case DESELECT_REGIONS : { - return Object.assign({}, state, { + return { + ...state, regionsSelected : state.regionsSelected.filter(re => action.deselectRegions.findIndex(dRe => dRe.name === re.name) < 0) - }) + } } case SELECT_REGIONS : { - return Object.assign({},state,{ - regionsSelected : action.selectRegions.map(region=>Object.assign({},region,{ - labelIndex : Number(region.labelIndex) - })) - }) + return { + ...state, + regionsSelected : action.selectRegions.map(region => { + return { + ...region, + labelIndex: Number(region.labelIndex) + } + }) + } } case DESELECT_LANDMARKS : { - return Object.assign({}, state, { + return { + ...state, landmarksSelected : state.landmarksSelected.filter(lm => action.deselectLandmarks.findIndex(dLm => dLm.name === lm.name) < 0) - }) + } } case SELECT_LANDMARKS : { - return Object.assign({}, state, { + return { + ...state, landmarksSelected : action.landmarks - }) + } } case USER_LANDMARKS : { - return Object.assign({}, state, { - userLandmarks : action.landmarks - }) + return { + ...state, + userLandmarks: action.landmarks + } } default : return state diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts index 378494853832f0fb5f7b39215dc9a83884599e8a..146d7a44649df836cdbbc57bf6b93d38e3fcda59 100644 --- a/src/ui/nehubaContainer/nehubaContainer.component.ts +++ b/src/ui/nehubaContainer/nehubaContainer.component.ts @@ -346,7 +346,7 @@ export class NehubaContainer implements OnInit, OnDestroy{ ).subscribe(landmarks => { this.userLandmarks = landmarks if(this.nehubaViewer){ - this.nehubaViewer.addUserLandmarks(landmarks) + this.nehubaViewer.updateUserLandmarks(landmarks) } }) ) diff --git a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts index dd34a2bc2cf25e2adf664c0c3f77b235d52406a2..226a18e0f1288dbd0440a648a47b5ed06a8c2add 100644 --- a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts +++ b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts @@ -482,7 +482,7 @@ export class NehubaViewerUnit implements OnDestroy{ } // TODO single landmark for user landmark - public addUserLandmarks(landmarks:any[]){ + public updateUserLandmarks(landmarks:any[]){ if(!this.nehubaViewer) return this.workerService.worker.postMessage({