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

chore: remove used var/fn

chore: add explicit typing
feat: UI indicating parc/space is supported in current selection
bugfix: parcellation view stories provide mock store
feat: parc tile: allow tmpl inj to be used for grped parcs
chore: add box sizing border box to tile component
bugfix: on select tmpl/parc, auto switch if curr parc/tmpl unsuitable
bugfix: resize directive GC
parent 94da1adf
No related branches found
No related tags found
No related merge requests found
export * as selectors from "./selectors"
export { fromRootStore } from "./util"
export { nameSpace } from "./const"
export { reducer, AtlasSelectionState, defaultState } from "./store"
export { nameSpace, AtlasSelectionState } from "./const"
export { reducer, defaultState } from "./store"
export * as actions from "./actions"
export { Effect } from "./effects"
\ No newline at end of file
import { createSelector } from "@ngrx/store"
import { nameSpace } from "./const"
import { AtlasSelectionState } from "./store"
import { nameSpace, AtlasSelectionState } from "./const"
export const viewerStateHelperStoreName = 'viewerStateHelper'
......
import { createReducer, on } from "@ngrx/store";
import { SapiAtlasModel, SapiParcellationModel, SapiRegionModel, SapiSpaceModel } from "src/atlasComponents/sapi";
import * as actions from "./actions"
import { ViewerMode, BreadCrumb } from "./const"
import { AtlasSelectionState } from "./const"
function getRegionLabelIndex(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: SapiParcellationModel, region: SapiRegionModel) {
const lblIdx = Number(region?.hasAnnotation?.internalIdentifier)
......@@ -9,31 +9,6 @@ function getRegionLabelIndex(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc:
return lblIdx
}
export type AtlasSelectionState = {
selectedAtlas: SapiAtlasModel
selectedTemplate: SapiSpaceModel
selectedParcellation: SapiParcellationModel
selectedParcellationAllRegions: SapiRegionModel[]
selectedRegions: SapiRegionModel[]
standAloneVolumes: string[]
/**
* the navigation may mean something very different
* depending on if the user is using threesurfer/nehuba view
*/
navigation: {
position: number[]
orientation: number[]
zoom: number
perspectiveOrientation: number[]
perspectiveZoom: number
}
viewerMode: ViewerMode
breadcrumbs: BreadCrumb[]
}
export const defaultState: AtlasSelectionState = {
selectedAtlas: null,
selectedParcellation: null,
......@@ -49,29 +24,13 @@ export const defaultState: AtlasSelectionState = {
const reducer = createReducer(
defaultState,
on(
actions.selectAtlas,
(state, { atlas }) => {
return {
...state,
selectedAtlas: atlas
}
}
),
on(
actions.selectTemplate,
(state, { template }) => {
return {
...state,
selectedTemplate: template
}
}
),
on(
actions.selectParcellation,
(state, { parcellation }) => {
actions.setATP,
(state, { atlas, parcellation, template }) => {
return {
...state,
selectedParcellation: parcellation
selectedAtlas: atlas || state.selectedAtlas,
selectedTemplate: template || state.selectedTemplate,
selectedParcellation: parcellation || state.selectedParcellation,
}
}
),
......
import { Directive, EventEmitter, Input, OnChanges, OnInit, Output } from "@angular/core";
import { Directive, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output } from "@angular/core";
import { Subscription } from "rxjs";
import { ResizeObserverService } from "./windowResize.service";
......@@ -7,7 +7,7 @@ import { ResizeObserverService } from "./windowResize.service";
exportAs: 'iavWindowResize'
})
export class ResizeObserverDirective implements OnChanges, OnInit {
export class ResizeObserverDirective implements OnChanges, OnInit, OnDestroy {
@Input('iav-window-resize-type')
type: 'debounce' | 'throttle' = 'throttle'
......@@ -34,6 +34,10 @@ export class ResizeObserverDirective implements OnChanges, OnInit {
this.configure()
}
ngOnDestroy(): void {
while(this.sub.length > 0) this.sub.pop().unsubscribe()
}
configure(){
while(this.sub.length > 0) this.sub.pop().unsubscribe()
......
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