Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 6x 6x 6x 6x 6x 4x 3x 3x 6x 6x 1x 1x | import { Injectable } from "@angular/core" import { Store } from "@ngrx/store" import { Actions, createEffect, ofType } from "@ngrx/effects" import { switchMap, filter, skip, take, tap, combineLatest, withLatestFrom, first } from "rxjs" import { CcState } from "../../../codeCharta.model" import { ThreeMapControlsService } from "../../../ui/codeMap/threeViewer/threeMapControls.service" import { visibleFileStatesSelector } from "../../selectors/visibleFileStates/visibleFileStates.selector" import { layoutAlgorithmSelector } from "../../store/appSettings/layoutAlgorithm/layoutAlgorithm.selector" import { resetCameraIfNewFileIsLoadedSelector } from "../../store/appSettings/resetCameraIfNewFileIsLoaded/resetCameraIfNewFileIsLoaded.selector" import { focusedNodePathSelector } from "../../store/dynamicSettings/focusedNodePath/focusedNodePath.selector" import { RenderCodeMapEffect } from "../renderCodeMapEffect/renderCodeMap.effect" @Injectable() export class AutoFitCodeMapEffect { constructor( private store: Store<CcState>, private renderCodeMapEffect: RenderCodeMapEffect, private threeMapControlsService: ThreeMapControlsService, private actions$: Actions ) {} autoFitTo$ = createEffect( () => combineLatest([ this.store.select(visibleFileStatesSelector), this.store.select(focusedNodePathSelector), this.store.select(layoutAlgorithmSelector) ]).pipe( skip(1), // initial map load is already fitted withLatestFrom(this.store.select(resetCameraIfNewFileIsLoadedSelector)), filter(([, resetCameraIfNewFileIsLoaded]) => resetCameraIfNewFileIsLoaded), switchMap(() => this.renderCodeMapEffect.renderCodeMap$.pipe(take(1))), tap(() => { this.threeMapControlsService.autoFitTo() }) ), { dispatch: false } ) autoFitToWhenResetCameraIfNewFileIsLoadedSetToFalse$ = createEffect( () => this.actions$.pipe( ofType("StartWithGlobalOption:resetCameraIfNewFileIsLoadedSetToFalse"), first(), switchMap(() => this.renderCodeMapEffect.renderCodeMap$.pipe(take(1))), tap(() => { this.threeMapControlsService.autoFitTo() }) ), { dispatch: false } ) } |