|
@@ -11,7 +11,6 @@ import CircleTextLabel from "../box/object/CircleTextLabel.js";
|
|
|
import PureTextLabel from "../box/object/PureTextLabel.js";
|
|
|
import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";
|
|
|
|
|
|
-
|
|
|
const convertScreenToNDC = function (event, domElement) {
|
|
|
let x = (event.offsetX / domElement.clientWidth) * 2 - 1;
|
|
|
let y = -(event.offsetY / domElement.clientHeight) * 2 + 1;
|
|
@@ -314,7 +313,7 @@ export default class Player {
|
|
|
);
|
|
|
lasPos.unproject(this.orthCamera);
|
|
|
lasPos.y = 5;
|
|
|
- const marker = new Marker(lasPos);
|
|
|
+ const marker = new Marker(lasPos, imageId);
|
|
|
|
|
|
const activeMarkeritem = {
|
|
|
id: imageId,
|
|
@@ -543,14 +542,14 @@ export default class Player {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- insertActiveMarker(item) {
|
|
|
- const exist = this.activeEdges.find((s) => item.id === s.id);
|
|
|
- if (exist) {
|
|
|
- exist.dir = [...new Set([...exist.dir, ...item.dir])];
|
|
|
- } else {
|
|
|
- this.activeEdges.push(item);
|
|
|
- }
|
|
|
- }
|
|
|
+ // insertActiveMarker(item) {
|
|
|
+ // const exist = this.activeEdges.find((s) => item.id === s.id);
|
|
|
+ // if (exist) {
|
|
|
+ // exist.dir = [...new Set([...exist.dir, ...item.dir])];
|
|
|
+ // } else {
|
|
|
+ // this.activeEdges.push(item);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
insertrenderTexts(item) {
|
|
|
const index = this.renderTexts.findIndex((s) => item.id === s.id);
|
|
@@ -727,7 +726,7 @@ export default class Player {
|
|
|
hor_markers.forEach((pos) => {
|
|
|
console.log("pos");
|
|
|
const p = new THREE.Vector3().fromArray(pos.point);
|
|
|
- const marker = new Marker(p);
|
|
|
+ const marker = new Marker(p, pos.id);
|
|
|
this.scene.scene.add(marker);
|
|
|
});
|
|
|
}
|
|
@@ -852,9 +851,10 @@ export default class Player {
|
|
|
//单多张图片删除时要删除相关数据
|
|
|
deleteImageDataByIds(ids) {
|
|
|
setTimeout(() => {
|
|
|
- console.warn("单多张图片删除时要删除相关数据");
|
|
|
- // this.clear();
|
|
|
- this.t_deleteImageDataByIds(ids);
|
|
|
+ console.warn("单多张图片删除时要删除相关数据", ids);
|
|
|
+ this.clear();
|
|
|
+ this.scene.emit("autoSave");
|
|
|
+ // this.t_deleteImageDataByIds(ids);
|
|
|
}, 500);
|
|
|
}
|
|
|
t_deleteImageDataByIds(ids) {
|
|
@@ -902,6 +902,37 @@ export default class Player {
|
|
|
this.scene.emit("autoSave");
|
|
|
}, 2500);
|
|
|
}
|
|
|
+
|
|
|
+ checkDeleteing() {
|
|
|
+ const makers = this.scene.scene.children.filter((obj) =>
|
|
|
+ String(obj.name).includes("marker_")
|
|
|
+ );
|
|
|
+ Array.from(makers).forEach((marker) => {
|
|
|
+ const { imageId, point } = marker.userData;
|
|
|
+ const image = this.scene.boxManager.imgList.find(
|
|
|
+ (item) => item.userData === imageId
|
|
|
+ );
|
|
|
+ if (image) {
|
|
|
+ const nPoint = new THREE.Vector3().fromArray(point);
|
|
|
+ nPoint.project(this.orthCamera);
|
|
|
+ console.log("nPoint", nPoint, point);
|
|
|
+
|
|
|
+ this.raycaster.setFromCamera(nPoint, this.orthCamera);
|
|
|
+ const intersects = this.raycaster.intersectObjects(
|
|
|
+ this.scene.boxManager.imgList,
|
|
|
+ false
|
|
|
+ );
|
|
|
+
|
|
|
+ if (image.userData !== intersects[0].object.userData) {
|
|
|
+ console.log("相交不正确");
|
|
|
+ this.scene.scene.remove(marker);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // const
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
update = () => {
|
|
|
if (this.floorplanControls.enabled) {
|
|
|
this.floorplanControls && this.floorplanControls.update();
|