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 | 6x 6x 6x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x 5x 5x 1x 1x 1x 1x 1x 1x | import { CreateSvgGeometryStrategy } from "../../CreateGeometryStrategies/createSvgGeometryStrategy" import { GeometryOptions } from "../../preview3DPrintMesh" import { MeshBasicMaterial } from "three" import { FrontLogo } from "./frontLogo" import { GeneralSizeChangeMesh } from "../generalMesh" export class CustomLogoMesh extends FrontLogo implements GeneralSizeChangeMesh { constructor( name: string, private filePath: string ) { super(name, "left") } async init(geometryOptions: GeometryOptions): Promise<CustomLogoMesh> { const createSvgStrategy = new CreateSvgGeometryStrategy() const size = (geometryOptions.frontTextSize * geometryOptions.width) / 200 this.geometry = await createSvgStrategy.create(geometryOptions, { filePath: this.filePath, 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) if (geometryOptions.secondRowVisible) { this.changeRelativeSize(geometryOptions) } this.updateColor(geometryOptions.numberOfColors) return this } setColor(color: string) { const material = this.material as MeshBasicMaterial material.color.set(color) } rotate() { this.geometry.rotateZ(Math.PI / 2) } flip() { this.geometry.rotateY(Math.PI) } changeSize(geometryOptions: GeometryOptions, oldWidth: number): void { this.position.x -= (geometryOptions.width - oldWidth) / 2 return } } |