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 | 9x 9x 9x 18x 18x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x | import { GeometryOptions } from "../../preview3DPrintMesh"
import { GeneralMesh } from "../generalMesh"
import { FrontPrintColorChangeStrategy } from "../../ColorChangeStrategies/frontPrintColorChangeStrategy"
export abstract class FrontLogo extends GeneralMesh {
constructor(
name: string,
private alignment: "right" | "left"
) {
super(name, new FrontPrintColorChangeStrategy())
}
changeRelativeSize(geometryOptions: GeometryOptions) {
const oldWidth = this.getWidth()
this.boundingBoxCalculated = false
const secondRowMeshVisible = geometryOptions.secondRowVisible
const scale = secondRowMeshVisible
? (geometryOptions.frontTextSize + geometryOptions.secondRowTextSize) / geometryOptions.frontTextSize
: 1
this.scale.x = scale
this.scale.y = scale
const secondRowVisibleFactor = secondRowMeshVisible ? -1 : 1
const alignmentFactor = this.alignment === "left" ? -1 : 1
this.translateY(secondRowVisibleFactor * geometryOptions.secondRowTextSize)
const translateXFactor = secondRowMeshVisible ? oldWidth / this.getWidth() : this.getWidth() / oldWidth
this.translateX(2 * translateXFactor * alignmentFactor * secondRowVisibleFactor)
}
}
|