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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 6x 6x 6x 6x 6x 6x 6x 6x 16x 16x 16x 9x 9x 9x 9x 9x 27x 27x 27x 9x 9x 1x 1x 1x 1x 1x 1x 16x 16x 16x 1x 1x 3x 1x 22x 22x 22x 2x 2x 2x 2x 2x 2x 7x | import { GeometryOptions } from "../../preview3DPrintMesh" import { GeneralMesh, GeneralSizeChangeMesh } from "../generalMesh" import { BackPrintColorChangeStrategy } from "../../ColorChangeStrategies/backPrintColorChangeStrategy" import { Font } from "three/examples/jsm/loaders/FontLoader" import { FrontTextMesh } from "./frontTextMesh" import { SecondRowTextMesh } from "./secondRowTextMesh" import { FrontMWLogoMesh } from "./frontMWLogoMesh" import { CustomLogoMesh } from "./customLogoMesh" import { FrontLogo } from "./frontLogo" export class FrontPrintContainerMesh extends GeneralMesh implements GeneralSizeChangeMesh { private childrenMeshes: Map<string, GeneralMesh> constructor(private font: Font) { const colorChangeStrategy = new BackPrintColorChangeStrategy() super("FrontPrintContainer", colorChangeStrategy) } async init(geometryOptions: GeometryOptions): Promise<FrontPrintContainerMesh> { this.childrenMeshes = new Map<string, GeneralMesh>() this.childrenMeshes.set("FrontText", new FrontTextMesh("FrontText", this.font, geometryOptions)) this.childrenMeshes.set("SecondRowText", new SecondRowTextMesh("SecondRowText", this.font, geometryOptions)) this.childrenMeshes.set("FrontMWLogo", new FrontMWLogoMesh("FrontMWLogo")) await Promise.all( [...this.childrenMeshes.values()].map(async mesh => { await mesh.init(geometryOptions) this.add(mesh) }) ) this.position.y = -geometryOptions.width / 2 - geometryOptions.mapSideOffset / 2 return this } async addCustomLogo(dataUrl: string, geometryOptions: GeometryOptions): Promise<void> { Iif (this.childrenMeshes.has("CustomLogo")) { this.removeCustomLogo() } const customLogoMesh = await new CustomLogoMesh("CustomLogo", dataUrl).init(geometryOptions) this.add(customLogoMesh) this.childrenMeshes.set(customLogoMesh.name, customLogoMesh) } rotateCustomLogo() { const customLogoMesh = this.childrenMeshes.get("CustomLogo") as CustomLogoMesh customLogoMesh.rotate() } flipCustomLogo() { const customLogoMesh = this.childrenMeshes.get("CustomLogo") as CustomLogoMesh customLogoMesh.flip() } removeCustomLogo() { this.remove(this.childrenMeshes.get("CustomLogo")) this.childrenMeshes.delete("CustomLogo") } updateCustomLogoColor(newColor: string) { const customLogoMesh = this.childrenMeshes.get("CustomLogo") as CustomLogoMesh customLogoMesh.setColor(newColor) } async updateFrontText(frontText: string, geometryOptions: GeometryOptions) { const frontTextMesh = this.childrenMeshes.get("FrontText") as FrontTextMesh frontTextMesh.updateTextGeometryOptions(frontText) await frontTextMesh.updateText(geometryOptions) } changeSize(geometryOptions: GeometryOptions, oldWidth: number): void { this.position.y -= (geometryOptions.width - oldWidth) / 2 for (const mesh of this.childrenMeshes.values()) { if (mesh instanceof FrontLogo && mesh.isGeneralSizeChangeMesh()) { mesh.changeSize(geometryOptions, oldWidth) } } } async updateSecondRowText(secondRowText: string, geometryOptions: GeometryOptions) { const secondRowTextMesh = this.childrenMeshes.get("SecondRowText") as SecondRowTextMesh secondRowTextMesh.updateTextGeometryOptions(secondRowText) await secondRowTextMesh.updateText(geometryOptions) } updateSecondRowVisibility(geometryOptions: GeometryOptions) { const frontMWLogoMesh = this.childrenMeshes.get("FrontMWLogo") as FrontMWLogoMesh const secondRowMesh = this.childrenMeshes.get("SecondRowText") as SecondRowTextMesh const customLogoMesh = this.childrenMeshes.get("CustomLogo") as CustomLogoMesh secondRowMesh.setManualVisibility(geometryOptions.secondRowVisible) frontMWLogoMesh.changeRelativeSize(geometryOptions) customLogoMesh?.changeRelativeSize(geometryOptions) } getChildrenMeshes(): Map<string, GeneralMesh> { return this.childrenMeshes } } |