import * as THREE from "three"; import TouchEdge from "./TouchEdge"; export default class ImgLabel extends THREE.Mesh { constructor(texture, matLine, isHorizontal = true) { let width, height, p; if (isHorizontal) { width = 1.5; height = 0.85; p = [ [-0.75, 0, -0.425, 0.75, 0, -0.425], [-0.75, 0, -0.425, -0.75, 0, 0.425], [-0.75, 0, 0.425, 0.75, 0, 0.425], [0.75, 0, 0.425, 0.75, 0, -0.425], ]; } else { width = 1.5; height = 2; p = [ [-0.75, 0, -1, 0.75, 0, -1], [-0.75, 0, -1, -0.75, 0, 1], [-0.75, 0, 1, 0.75, 0, 1], [0.75, 0, 1, 0.75, 0, -1], ]; } const g = new THREE.PlaneGeometry(width, height); g.rotateX(-Math.PI / 2); const m = new THREE.MeshBasicMaterial({ map: texture, }); super(g, m); this.width = width; this.height = height; this.touchLines = new TouchEdge(p, matLine); this.touchLines.position.y += 0.5; this.add(this.touchLines); // this.touchLines.children.forEach((child) => (child.visible = true)); this.name = "imglabel"; } }