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

fix: on t/p/a selection, clear curr selected feat

parent 840845ce
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@
## Bugfixes
- Fixed point assignment full table not showing
- On template/parcellation/atlas change, clear currently selected feature
## Behind the scenes
......
import { createSelector, select } from "@ngrx/store";
import { forkJoin, of, pipe } from "rxjs";
import { distinctUntilChanged, map, switchMap } from "rxjs/operators";
import { SAPI } from "src/atlasComponents/sapi";
import { translateV3Entities } from "src/atlasComponents/sapi/translateV3"
import { pipe } from "rxjs";
import { distinctUntilChanged, map } from "rxjs/operators";
import { SxplrAtlas, SxplrParcellation, SxplrTemplate } from "src/atlasComponents/sapi/sxplrTypes";
import { jsonEqual } from "src/util/json";
import * as selectors from "./selectors"
......
......@@ -71,6 +71,7 @@ export function getStoreEffects() {
plugins.Effects,
atlasSelection.Effect,
userInterface.Effects,
userInteraction.Effect,
]
}
......
import { Injectable } from "@angular/core";
import { Actions, createEffect, ofType } from "@ngrx/effects";
import * as atlasSelectionActions from "../atlasSelection/actions"
import * as userInterface from "../userInterface"
import { mapTo } from "rxjs/operators";
import * as atlasSelection from "../atlasSelection"
import * as actions from "./actions"
import { filter, map, mapTo, skip } from "rxjs/operators";
import { Store } from "@ngrx/store";
@Injectable()
export class Effect {
onStandAloneVolumesExistCloseMatDrawer = createEffect(() => this.action.pipe(
ofType(atlasSelectionActions.clearStandAloneVolumes),
ofType(atlasSelection.actions.clearStandAloneVolumes),
mapTo(userInterface.actions.closeSidePanel())
))
constructor(private action: Actions){
#distinctATP$ = this.store.pipe(
atlasSelection.fromRootStore.distinctATP(),
)
onATPUpdateUnselectFeature = createEffect(() => this.#distinctATP$.pipe(
filter(v => !!v.atlas && !!v.parcellation && !!v.template),
/**
* First non empty emit would be from selecting atlas.
* So ignore it.
*/
skip(1),
map(() => actions.clearShownFeature())
))
constructor(private action: Actions, private store: Store){
}
}
\ No newline at end of file
}
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