ldj vor 1 Jahr
Ursprung
Commit
020c8aef12
1 geänderte Dateien mit 20 neuen und 0 gelöschten Zeilen
  1. 20 0
      src/core/box/object/Line.js

+ 20 - 0
src/core/box/object/Line.js

@@ -14,37 +14,57 @@ function pointsToArray(arr) {
 export default class TouchEdge extends Line2 {
   constructor(startPoint, endPoint, endEdge, matLine) {
     let points;
+    let g = new THREE.PlaneGeometry(0.1, 0.1)
+    let m = new THREE.MeshBasicMaterial({
+      map: new THREE.TextureLoader().load('assets/image/goto.png'),
+      color: 0x26559b,
+      transparent: true
+    })
+    g.rotateX(-Math.PI / 2)
+    let cross = new THREE.Mesh(g, m)
+
     if(endEdge.name === 0) { //top
       let a = startPoint.clone()
       let b = new THREE.Vector3(startPoint.x, startPoint.y, endEdge.y + endEdge.parent.parent.position.z - offset)
       let c = new THREE.Vector3(endPoint.x, endPoint.y, endEdge.y + endEdge.parent.parent.position.z - offset)
       let d = new THREE.Vector3(endPoint.x, endPoint.y, endEdge.y + endEdge.parent.parent.position.z)
+      cross.rotation.y = 0
+      cross.position.copy(d)
       points = pointsToArray([a,b,c,d])
     } else if(endEdge.name === 1) { //left
       let a = startPoint.clone()
       let b = new THREE.Vector3((startPoint.x + endPoint.x) / 2, startPoint.y, startPoint.z)
       let c = new THREE.Vector3((startPoint.x + endPoint.x) / 2, startPoint.y, endPoint.z)
       let d = new THREE.Vector3(endEdge.x + endEdge.parent.parent.parent.position.x, startPoint.y, endPoint.z)
+      cross.rotation.y = -Math.PI/2
+      cross.position.copy(d)
       points = pointsToArray([a,b,c,d])
     } else if(endEdge.name === 2) { //bottom
       let a = startPoint.clone()
       let b = new THREE.Vector3(startPoint.x, startPoint.y, endEdge.y + endEdge.parent.parent.position.z + offset)
       let c = new THREE.Vector3(endPoint.x, endPoint.y, endEdge.y + endEdge.parent.parent.position.z + offset)
       let d = new THREE.Vector3(endPoint.x, endPoint.y, endEdge.y + endEdge.parent.parent.position.z)
+      cross.rotation.y = Math.PI/2
+      cross.position.copy(d)
       points = pointsToArray([a,b,c,d])
     } else { //right 
       let a = startPoint.clone()
       let b = new THREE.Vector3((startPoint.x + endPoint.x) / 2, startPoint.y, startPoint.z)
       let c = new THREE.Vector3((startPoint.x + endPoint.x) / 2, startPoint.y, endPoint.z)
       let d = new THREE.Vector3(endEdge.x + endEdge.parent.parent.parent.position.x, startPoint.y, endPoint.z)
+      cross.rotation.y = Math.PI/2
+      cross.position.copy(d)
       points = pointsToArray([a,b,c,d])
     }
 
     const geometry = new LineGeometry();
     geometry.setPositions(points);
 
+    
+
     super(geometry, matLine);
     this.scale.set(1, 1, 1);
     this.position.y += 0.5
+    this.add(cross)
   }
 }