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 | 16x 16x 16x 16x 16x 5x 11x 11x 11x 8x 8x 8x 8x 3x 3x 3x 3x | import BoundingBox from "./boundingBox" import Rectangle from "./rectangle" import { Vector2 } from "three" import { CodeMapNode } from "../../../codeCharta.model" export enum StreetOrientation { Horizontal, Vertical } export default abstract class Street extends BoundingBox { streetRect: Rectangle | undefined protected spacer = 2 protected abstract layoutStreet(origin: Vector2, maxNodeSideLength: number): CodeMapNode protected abstract splitChildrenToRows(children: BoundingBox[]): void protected abstract calculateStreetOverhang(streetOrigin: Vector2): number protected abstract rearrangeRows(): void protected getStreetThickness(): number { const pathParts = this.mapNode.path.split("/") const isDirectChildOfRoot = this.mapNode.path.startsWith("/root/") && pathParts.length === 3 && pathParts[2] !== "" return this.mapNode.path === "/root" || isDirectChildOfRoot ? this.calculateRootStreetThickness(this.mapNode) : this.calculateNonRootThickness(this.mapNode) } protected calculateNonRootThickness(node: CodeMapNode): number { const baseThickness = 2 const sizeFactor = 0.0005 const fileSize = node.attributes.unary return baseThickness + fileSize * sizeFactor } protected calculateRootStreetThickness(node: CodeMapNode): number { const baseThickness = 8 const sizeFactor = 0.001 const fileSize = node.attributes.unary return baseThickness + fileSize * sizeFactor } } |