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

100% Statements 9/9
100% Branches 1/1
100% Functions 1/1
100% Lines 9/9

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      6x 6x   6x   8x 8x 5x   8x                 8x 8x      
import { GeometryOptions } from "../../preview3DPrintMesh"
import { Font } from "three/examples/jsm/loaders/FontLoader"
import { CreateTextGeometryStrategyOptions } from "../../CreateGeometryStrategies/createTextGeometryStrategy"
import { TextMesh } from "../textMesh"
import { FrontPrintColorChangeStrategy } from "../../ColorChangeStrategies/frontPrintColorChangeStrategy"
 
export class FrontTextMesh extends TextMesh {
    constructor(name: string, font: Font, geometryOptions: GeometryOptions) {
        let text = geometryOptions.frontText
        if (!text) {
            text = "FrontText"
        }
        const createFrontTextGeometryOptions: CreateTextGeometryStrategyOptions = {
            font,
            side: "front",
            text,
            xPosition: 0,
            yPosition: geometryOptions.frontTextSize / 2,
            textSize: geometryOptions.frontTextSize,
            align: "center"
        }
        super(name, new FrontPrintColorChangeStrategy(), 0, true, createFrontTextGeometryOptions)
        this.name = "Front Text"
    }
}