All files / app/codeCharta/services/3DExports/3DPreview/MeshModels/FrontMeshModels frontMWLogoMesh.ts

94.11% Statements 16/17
50% Branches 1/2
100% Functions 4/4
94.11% Lines 16/17

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 386x   6x     6x   7x     7x 7x 7x           7x 7x 7x 7x   7x       7x   7x       2x 2x      
import { CreateSvgGeometryStrategy } from "./../../CreateGeometryStrategies/createSvgGeometryStrategy"
import { GeometryOptions } from "../../preview3DPrintMesh"
import { FrontLogo } from "./frontLogo"
import { GeneralSizeChangeMesh } from "../generalMesh"
 
export class FrontMWLogoMesh extends FrontLogo implements GeneralSizeChangeMesh {
    constructor(name: string) {
        super(name, "right")
    }
 
    async init(geometryOptions: GeometryOptions, createSvgGeometryStrategy = new CreateSvgGeometryStrategy()): Promise<FrontMWLogoMesh> {
        const size = (geometryOptions.frontTextSize * geometryOptions.width) / 250
        this.geometry = await createSvgGeometryStrategy.create(geometryOptions, {
            filePath: "codeCharta/assets/mw_logo.svg",
            size,
            side: "front"
        })
 
        const xPosition = geometryOptions.width / 2 - size / 2 - geometryOptions.mapSideOffset / 2
        const yPosition = size / 2
        const zPosition = geometryOptions.printHeight / 2
        this.position.set(xPosition, yPosition, zPosition)
 
        Iif (geometryOptions.secondRowVisible) {
            this.changeRelativeSize(geometryOptions)
        }
 
        this.updateColor(geometryOptions.numberOfColors)
 
        return this
    }
 
    changeSize(geometryOptions: GeometryOptions, oldWidth: number): void {
        this.position.x += (geometryOptions.width - oldWidth) / 2
        return
    }
}