|
@@ -14,20 +14,31 @@ function pointsToArray(arr) {
|
|
|
export default class TouchEdge extends Line2 {
|
|
|
constructor(startPoint, endPoint, endEdge, matLine) {
|
|
|
let points;
|
|
|
- // if(endEdge.name === 0) { //top
|
|
|
+ if(endEdge.name === 0) { //top
|
|
|
let a = startPoint.clone()
|
|
|
- let b = new THREE.Vector3(startPoint.x, startPoint.y, endEdge.y - offset)
|
|
|
- let c = new THREE.Vector3(endPoint.x, endPoint.y, endEdge.y - offset)
|
|
|
- let d = new THREE.Vector3(endPoint.x, endPoint.y, endEdge.y)
|
|
|
+ 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)
|
|
|
points = pointsToArray([a,b,c,d])
|
|
|
- console.log(points)
|
|
|
- // } else if(endEdge.name === 1) { //left
|
|
|
-
|
|
|
- // } else if(endEdge.name === 2) { //bottom
|
|
|
-
|
|
|
- // } else { //right
|
|
|
-
|
|
|
- // }
|
|
|
+ } 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)
|
|
|
+ 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)
|
|
|
+ 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)
|
|
|
+ points = pointsToArray([a,b,c,d])
|
|
|
+ }
|
|
|
|
|
|
const geometry = new LineGeometry();
|
|
|
geometry.setPositions(points);
|