All files / app/codeCharta/ui/codeMap codeMap.component.ts

96% Statements 24/25
100% Branches 0/0
75% Functions 3/4
95.83% Lines 23/24

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 512x 2x 2x 2x 2x 2x 2x 2x   2x 2x 2x                 2x 2x 2x         1x 1x           2x 2x 2x 2x 2x       1x 1x              
import { Component, AfterViewInit, ElementRef, OnDestroy } from "@angular/core"
import { isLoadingFileSelector } from "../../state/store/appSettings/isLoadingFile/isLoadingFile.selector"
import { ThreeViewerService } from "./threeViewer/threeViewer.service"
import { sharpnessModeSelector } from "../../state/store/appSettings/sharpnessMode/sharpnessMode.selector"
import { CodeMapMouseEventService } from "./codeMap.mouseEvent.service"
import { skip, tap } from "rxjs"
import { IsAttributeSideBarVisibleService } from "../../services/isAttributeSideBarVisible.service"
import { Store } from "@ngrx/store"
import { CcState } from "../../codeCharta.model"
import { ViewCubeComponent } from "../viewCube/viewCube.component"
import { AttributeSideBarComponent } from "../attributeSideBar/attributeSideBar.component"
import { AsyncPipe } from "@angular/common"
 
@Component({
    selector: "cc-code-map",
    templateUrl: "./codeMap.component.html",
    styleUrls: ["./codeMap.component.scss"],
    standalone: true,
    imports: [ViewCubeComponent, AttributeSideBarComponent, AsyncPipe]
})
export class CodeMapComponent implements AfterViewInit, OnDestroy {
    isLoadingFile$ = this.store.select(isLoadingFileSelector)
    restartOnSharpnessModeChangesSubscription = this.store
        .select(sharpnessModeSelector)
        .pipe(
            skip(1),
            tap(() => {
                this.threeViewerService.restart(this.elementReference.nativeElement.querySelector("#codeMap"))
                this.codeMapMouseEventService.start()
            })
        )
        .subscribe()
 
    constructor(
        public isAttributeSideBarVisibleService: IsAttributeSideBarVisibleService,
        private store: Store<CcState>,
        private threeViewerService: ThreeViewerService,
        private codeMapMouseEventService: CodeMapMouseEventService,
        private elementReference: ElementRef
    ) {}
 
    ngAfterViewInit(): void {
        this.threeViewerService.init(this.elementReference.nativeElement.querySelector("#codeMap"))
        this.codeMapMouseEventService.start()
    }
 
    ngOnDestroy(): void {
        this.restartOnSharpnessModeChangesSubscription.unsubscribe()
    }
}