All files / app/codeCharta/services/3DExports/3DPreview/MeshModels/BackMeshModels codeChartaLogoMesh.ts

100% Statements 14/14
100% Branches 1/1
100% Functions 2/2
100% Lines 14/14

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 326x 6x   6x   6x       5x 5x       5x 5x           5x 5x 5x 5x   5x   5x      
import { BackPrintColorChangeStrategy } from "../../ColorChangeStrategies/backPrintColorChangeStrategy"
import { CreateSvgGeometryStrategy } from "../../CreateGeometryStrategies/createSvgGeometryStrategy"
import { GeometryOptions } from "../../preview3DPrintMesh"
import { CustomVisibilityMesh } from "../customVisibilityMesh"
 
export class CodeChartaLogoMesh extends CustomVisibilityMesh {
    private createSvgStrategy: CreateSvgGeometryStrategy
 
    constructor(name: string, createSvgStrategy: CreateSvgGeometryStrategy = new CreateSvgGeometryStrategy()) {
        super(name, new BackPrintColorChangeStrategy(), 180, true)
        this.createSvgStrategy = createSvgStrategy
    }
 
    async init(geometryOptions: GeometryOptions): Promise<CodeChartaLogoMesh> {
        const size = 0.17
        this.geometry = await this.createSvgStrategy.create(geometryOptions, {
            filePath: "codeCharta/assets/codecharta_logo.svg",
            size,
            side: "back"
        })
 
        const xPosition = 0
        const yPosition = 0.18 - size / 2
        const zPosition = -geometryOptions.baseplateHeight + geometryOptions.printHeight / 2
        this.position.set(xPosition, yPosition, zPosition)
 
        this.updateColor(geometryOptions.numberOfColors)
 
        return this
    }
}