|
@@ -185,11 +185,10 @@ export default class Player {
|
|
|
this.raycaster.setFromCamera(this.pointerdown, this.orthCamera);
|
|
|
let intersectArr = this.scene.boxManager.imgList;
|
|
|
const intersects = this.raycaster.intersectObjects(intersectArr, false);
|
|
|
- console.log("intersects", intersects);
|
|
|
+
|
|
|
if (intersects[0]) {
|
|
|
// this.drawing = false;
|
|
|
const imageId = intersects[0].object.userData;
|
|
|
-
|
|
|
let lasPos = new THREE.Vector3(
|
|
|
this.pointerdown.x,
|
|
|
this.pointerdown.y,
|
|
@@ -235,10 +234,12 @@ export default class Player {
|
|
|
this.renderLines.push(points);
|
|
|
this.scene.scene.add(finishLine);
|
|
|
const imageId = this.touchImg.object.userData;
|
|
|
+
|
|
|
const activeLineItem = {
|
|
|
id: imageId,
|
|
|
dir: [dir],
|
|
|
};
|
|
|
+
|
|
|
console.log("this.touchImg", activeLineItem, points);
|
|
|
this.insertActiveEdge(activeLineItem);
|
|
|
this.drawLine = null;
|
|
@@ -371,15 +372,26 @@ export default class Player {
|
|
|
showAllActiveEdges() {
|
|
|
if (this.inited) {
|
|
|
let imgList = this.scene.boxManager.imgList;
|
|
|
- this.activeEdges.forEach((edge) => {
|
|
|
- const exist = imgList.find((item) => item.userData === edge.id);
|
|
|
- // console.log("exist", exist);
|
|
|
- if (exist) {
|
|
|
- edge.dir.forEach((dir) => {
|
|
|
- exist.touchLines.children[dir].visible = true;
|
|
|
+ if (this.activeEdges.length > 0) {
|
|
|
+ this.activeEdges.forEach((edge) => {
|
|
|
+ const exist = imgList.find((item) => item.userData === edge.id);
|
|
|
+ // console.log("exist", exist);
|
|
|
+ if (exist) {
|
|
|
+ edge.dir.forEach((dir) => {
|
|
|
+ exist.touchLines.children[dir].visible = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ imgList.forEach((img) => {
|
|
|
+ // console.log("img", img);
|
|
|
+ img.touchLines.children.forEach((line) => {
|
|
|
+ if (line.visible) {
|
|
|
+ line.visible = false;
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
getDrawData() {
|
|
@@ -471,6 +483,14 @@ export default class Player {
|
|
|
this.drawing = false;
|
|
|
}
|
|
|
|
|
|
+ clear() {
|
|
|
+ this.activeEdges = [];
|
|
|
+ this.renderLines = [];
|
|
|
+ this.renderMarkers = [];
|
|
|
+ this.scene.clearDrawScene();
|
|
|
+ this.reset();
|
|
|
+ }
|
|
|
+
|
|
|
update = () => {
|
|
|
if (this.floorplanControls.enabled) {
|
|
|
this.floorplanControls && this.floorplanControls.update();
|