Skip to content
Snippets Groups Projects
Unverified Commit d7c11bd9 authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #1204 from FZJ-INM1-BDA/bugfix_touchCtrlApiEndpoint

bugfix: fix touch ctrl, fix api endpoint
parents 3797f6cb f6bf6713
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
"name": "interactive-viewer",
"version": "2.7.0",
"description": "siibra-explorer - explore brain atlases. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular",
"version": "2.7.0",
"scripts": {
"lint": "eslint src --ext .ts",
"eslint": "eslint",
......
......@@ -30,7 +30,7 @@ type RegistryType = SAPIAtlas | SAPISpace | SAPIParcellation
@Injectable()
export class SAPI{
static bsEndpoint = `https://siibra-api-latest.apps-dev.hbp.eu/v2_0` || environment.BS_REST_URL
static bsEndpoint = environment.BS_REST_URL || `https://siibra-api-latest.apps-dev.hbp.eu/v2_0`
public bsEndpoint = SAPI.bsEndpoint
......
......@@ -2,7 +2,6 @@ import { createSelector } from "@ngrx/store"
import { nameSpace } from "./const"
import { Annotation, AnnotationState } from "./store"
import { selectors as atlasSelectionSelectors } from "../atlasSelection"
import { annotation } from ".."
const selectStore = state => state[nameSpace] as AnnotationState
......
import { TestBed } from "@angular/core/testing"
import { provideMockActions } from "@ngrx/effects/testing"
import { Action } from "@ngrx/store"
import { MockStore, provideMockStore } from "@ngrx/store/testing"
import { hot } from "jasmine-marbles"
import { Observable } from "rxjs"
import { annotation, atlasAppearance } from "src/state"
import { NgAnnotationEffects } from "./effects"
describe("effects.ts", () => {
describe("NgAnnotationEffects", () => {
let actions$: Observable<Action>
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
provideMockStore(),
provideMockActions(() => actions$),
NgAnnotationEffects,
]
})
})
describe("onAnnotationHideQuadrant", () => {
describe("> when space filtered annotation does not exist", () => {
it("> should setOctantRemoval true", () => {
const mockStore = TestBed.inject(MockStore)
mockStore.overrideSelector(annotation.selectors.spaceFilteredAnnotations, [])
const effect = TestBed.inject(NgAnnotationEffects)
expect(effect.onAnnotationHideQuadrant).toBeObservable(
hot('a', {
a: atlasAppearance.actions.setOctantRemoval({
flag: true
})
})
)
})
})
describe("> when space filtered annotation exist", () => {
it("> should setOctantRemoval false", () => {
const mockStore = TestBed.inject(MockStore)
mockStore.overrideSelector(annotation.selectors.spaceFilteredAnnotations, [{} as any])
const effect = TestBed.inject(NgAnnotationEffects)
expect(effect.onAnnotationHideQuadrant).toBeObservable(
hot('a', {
a: atlasAppearance.actions.setOctantRemoval({
flag: false
})
})
)
})
})
describe("> on switch of space filtered annotations length", () => {
it("> should emit accordingly")
})
describe("> on repeated emit of space filtered annotations length", () => {
it("> should only emit once")
})
})
})
})
\ No newline at end of file
import { Injectable } from "@angular/core";
import { createEffect } from "@ngrx/effects";
import { select, Store } from "@ngrx/store";
import { map } from "rxjs/operators";
import { distinctUntilChanged, map } from "rxjs/operators";
import { annotation, atlasAppearance } from "src/state"
@Injectable()
......@@ -10,8 +10,9 @@ export class NgAnnotationEffects{
onAnnotationHideQuadrant = createEffect(() => this.store.pipe(
select(annotation.selectors.spaceFilteredAnnotations),
map(arr => {
const spaceFilteredAnnotationExists = arr.length > 0
map(arr => arr.length > 0),
distinctUntilChanged(),
map(spaceFilteredAnnotationExists => {
return atlasAppearance.actions.setOctantRemoval({
flag: !spaceFilteredAnnotationExists
})
......
......@@ -27,9 +27,20 @@ export class NehubaViewerTouchDirective implements OnDestroy{
public translate$: Observable<any>
private nehubaUnit: NehubaViewerUnit
private htmlElementIndexMap = new WeakMap<HTMLElement, number>()
private findPanelIndex(panel: HTMLElement){
if (!this.nehubaUnit) return null
return Array.from(this.nehubaUnit?.nehubaViewer?.ngviewer?.display?.panels || []).indexOf(panel)
if (!this.htmlElementIndexMap.has(panel)) {
Array.from(this.nehubaUnit?.nehubaViewer?.ngviewer?.display?.panels || []).forEach((el, idx) => {
if (el['element']) {
this.htmlElementIndexMap.set(
el['element'] as HTMLElement,
idx
)
}
})
}
return this.htmlElementIndexMap.get(panel)
}
private _exportNehuba: any
......
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