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

100% Statements 15/15
100% Branches 0/0
100% Functions 2/2
100% Lines 15/15

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