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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 11x 11x 11x 11x 11x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 56x 56x | import { Component, Input, OnInit } from "@angular/core"
import { CcState, CodeMapNode } from "../../../../../codeCharta.model"
import { setRightClickedNodeData } from "../../../../../state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions"
import { rightClickedNodeDataSelector } from "../../../../../state/store/appStatus/rightClickedNodeData/rightClickedNodeData.selector"
import { hoveredNodeIdSelector } from "../../../../../state/store/appStatus/hoveredNodeId/hoveredNodeId.selector"
import { areaMetricSelector } from "../../../../../state/store/dynamicSettings/areaMetric/areaMetric.selector"
import { Store } from "@ngrx/store"
import { setHoveredNodeId } from "../../../../../state/store/appStatus/hoveredNodeId/hoveredNodeId.actions"
import { ThreeSceneService } from "../../../../codeMap/threeViewer/threeSceneService"
import { IdToBuildingService } from "../../../../../services/idToBuilding/idToBuilding.service"
import { ThreeRendererService } from "../../../../codeMap/threeViewer/threeRenderer.service"
import { CodeMapMouseEventService } from "../../../../codeMap/codeMap.mouseEvent.service"
import { isAreaValid, AreaMetricValidPipe } from "../areaMetricValidPipe.pipe"
import { MapTreeViewItemIconComponent } from "../mapTreeViewItemIcon/mapTreeViewItemIcon.component"
import { MapTreeViewItemNameComponent } from "../mapTreeViewItemName/mapTreeViewItemName.component"
import { MapTreeViewItemOptionButtonsComponent } from "../mapTreeViewItemOptionButtons/mapTreeViewItemOptionButtons.component"
import { AsyncPipe } from "@angular/common"
import { IsNodeLeafPipe } from "../isNodeLeaf.pipe"
@Component({
selector: "cc-map-tree-view-level",
templateUrl: "./mapTreeViewLevel.component.html",
styleUrls: ["./mapTreeViewLevel.component.scss"],
standalone: true,
imports: [
MapTreeViewItemIconComponent,
MapTreeViewItemNameComponent,
MapTreeViewItemOptionButtonsComponent,
AsyncPipe,
AreaMetricValidPipe,
IsNodeLeafPipe
]
})
export class MapTreeViewLevelComponent implements OnInit {
@Input() node: CodeMapNode
@Input() depth: number
hoveredNodeId$ = this.store.select(hoveredNodeIdSelector)
rightClickedNodeData$ = this.store.select(rightClickedNodeDataSelector)
areaMetric$ = this.store.select(areaMetricSelector)
isOpen = false
areMetricValid = false
constructor(
private store: Store<CcState>,
private threeSceneService: ThreeSceneService,
private idToBuildingService: IdToBuildingService,
private threeRendererService: ThreeRendererService,
private codeMapMouseEventService: CodeMapMouseEventService
) {}
ngOnInit(): void {
// open root folder initially
this.isOpen = this.depth === 0
}
onMouseEnter() {
const building = this.idToBuildingService.get(this.node.id)
const labels = this.threeSceneService.labels?.children
this.codeMapMouseEventService.setLabelHoveredLeaf(building, labels)
this.codeMapMouseEventService.hoverNode(this.node.id)
this.store.dispatch(setHoveredNodeId({ value: this.node.id }))
}
onMouseLeave() {
this.threeSceneService.resetLabel()
this.codeMapMouseEventService.unhoverNode()
this.codeMapMouseEventService.clearLabelHoveredBuilding()
this.store.dispatch(setHoveredNodeId({ value: null }))
}
onClick() {
this.isOpen = !this.isOpen
const building = this.idToBuildingService.get(this.node.id)
this.codeMapMouseEventService.drawLabelSelectedBuilding(building)
this.threeSceneService.selectBuilding(building)
this.threeSceneService.clearConstantHighlight()
this.threeRendererService.render()
}
openNodeContextMenu = $event => {
$event.preventDefault()
$event.stopPropagation()
this.areaMetric$.subscribe(areaMetricName => (this.areMetricValid = isAreaValid(this.node, areaMetricName))).unsubscribe()
Iif (this.areMetricValid) {
this.store.dispatch(
setRightClickedNodeData({
value: {
nodeId: this.node.id,
xPositionOfRightClickEvent: $event.clientX,
yPositionOfRightClickEvent: $event.clientY
}
})
)
document.querySelector(".tree-element-0").addEventListener("scroll", this.scrollFunction)
}
}
private scrollFunction = () => {
this.store.dispatch(setRightClickedNodeData({ value: null }))
document.querySelector(".tree-element-0").removeEventListener("scroll", this.scrollFunction)
}
}
|