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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 4x 4x 4x 1x 1x 1x 1x 1x 3x | import { Injectable } from "@angular/core" import { createEffect } from "@ngrx/effects" import { State, Store } from "@ngrx/store" import { map } from "rxjs" import stringify from "safe-stable-stringify" import { CcState, MapColors } from "../../../codeCharta.model" import { setMapColors } from "../../store/appSettings/mapColors/mapColors.actions" import { defaultMapColors } from "../../store/appSettings/mapColors/mapColors.reducer" import { colorMetricSelector } from "../../store/dynamicSettings/colorMetric/colorMetric.selector" @Injectable() export class UpdateMapColorsEffect { constructor( private store: Store<CcState>, private state: State<CcState> ) {} updateMapColors$ = createEffect(() => this.store.select(colorMetricSelector).pipe( map(colorMetric => { const state = this.state.getValue() const attributeDescriptors = state.fileSettings.attributeDescriptors if (attributeDescriptors[colorMetric]?.direction === 1) { const reversedMapColors: MapColors = JSON.parse(stringify(state.appSettings.mapColors)) const temporary = reversedMapColors.negative reversedMapColors.negative = reversedMapColors.positive reversedMapColors.positive = temporary return setMapColors({ value: reversedMapColors }) } return setMapColors({ value: defaultMapColors }) }) ) ) } |