|
@@ -48,6 +48,7 @@ export default class Player {
|
|
|
this.renderMarkers = [];
|
|
|
this.activeEdges = [];
|
|
|
this.renderSymbols = [];
|
|
|
+ this.renderTexts = [];
|
|
|
this.matLine = null;
|
|
|
this.lineColor = 0xe44d54;
|
|
|
// 1是画线,2是标方向, 3符号, 4文本
|
|
@@ -79,7 +80,7 @@ export default class Player {
|
|
|
pos.unproject(this.orthCamera);
|
|
|
pos.y = 5;
|
|
|
this.symbolIndex += 1;
|
|
|
- this.symbol = new CircleTextLabel(this.symbolIndex, true);
|
|
|
+ this.symbol = new CircleTextLabel(this.symbolIndex, pos);
|
|
|
this.symbol.visible = false;
|
|
|
this.scene.scene.add(this.symbol);
|
|
|
console.log("this.symbol", this.symbol);
|
|
@@ -247,10 +248,31 @@ export default class Player {
|
|
|
intersects.forEach((i) => {
|
|
|
if (
|
|
|
String(i.object.name).includes("marker") ||
|
|
|
- String(i.object.name).includes("line")
|
|
|
+ String(i.object.name).includes("line") ||
|
|
|
+ String(i.object.name).includes("circle") ||
|
|
|
+ String(i.object.name).includes("pureText")
|
|
|
) {
|
|
|
+ let type;
|
|
|
+ switch (true) {
|
|
|
+ case String(i.object.name).includes("marker"):
|
|
|
+ type = 1;
|
|
|
+ break;
|
|
|
+ case String(i.object.name).includes("line"):
|
|
|
+ type = 2;
|
|
|
+ break;
|
|
|
+ case String(i.object.name).includes("circle"):
|
|
|
+ type = 3;
|
|
|
+ break;
|
|
|
+ case String(i.object.name).includes("pureText"):
|
|
|
+ type = 4;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
this.selectItem = i.object;
|
|
|
- this.scene.emit("confirmDelete", i.object.uuid);
|
|
|
+ this.scene.emit("confirmDelete", {
|
|
|
+ id: i.object.uuid,
|
|
|
+ type,
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -315,11 +337,15 @@ export default class Player {
|
|
|
this.pointerdown.y,
|
|
|
-1
|
|
|
);
|
|
|
+ lasPos.unproject(this.orthCamera);
|
|
|
+ lasPos.y = 5;
|
|
|
+
|
|
|
const activeSymbolItem = {
|
|
|
- id: this.symbolIndex,
|
|
|
+ index: this.symbolIndex,
|
|
|
point: lasPos.toArray(),
|
|
|
};
|
|
|
this.renderSymbols.push(activeSymbolItem);
|
|
|
+ console.log("activeSymbolItem", activeSymbolItem);
|
|
|
this.setMode(0);
|
|
|
}
|
|
|
}
|
|
@@ -523,7 +549,22 @@ export default class Player {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ deleteItemByType(type, pos) {
|
|
|
+ if (type === 1) {
|
|
|
+ }
|
|
|
+ if (type === 2) {
|
|
|
+ }
|
|
|
+ if (type === 3) {
|
|
|
+ const index = this.renderSymbols.findIndex((syb) => {
|
|
|
+ const p = new THREE.Vector3().fromArray(syb.point);
|
|
|
+ const v = new THREE.Vector3().fromArray(pos);
|
|
|
+ return p.equals(v);
|
|
|
+ });
|
|
|
+ this.renderSymbols.splice(index, 1);
|
|
|
+ }
|
|
|
+ if (type === 4) {
|
|
|
+ }
|
|
|
+ }
|
|
|
editing(item) {
|
|
|
if (item.type === 4) {
|
|
|
console.log("editing", item);
|
|
@@ -550,6 +591,7 @@ export default class Player {
|
|
|
hor_lines: this.renderLines,
|
|
|
hor_activeEdges: this.activeEdges,
|
|
|
hor_markers: this.renderMarkers,
|
|
|
+ hor_symbols: this.renderSymbols,
|
|
|
vir_lines: [],
|
|
|
vir_activeEdges: [],
|
|
|
vir_markers: [],
|
|
@@ -562,6 +604,7 @@ export default class Player {
|
|
|
vir_lines: this.renderLines,
|
|
|
vir_activeEdges: this.activeEdges,
|
|
|
vir_markers: this.renderMarkers,
|
|
|
+ vir_symbols: this.renderSymbols,
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -576,7 +619,7 @@ export default class Player {
|
|
|
load(type, data) {
|
|
|
if (type === 1) {
|
|
|
console.log("data1", data);
|
|
|
- const { hor_activeEdges, hor_lines, hor_markers } = data;
|
|
|
+ const { hor_activeEdges, hor_lines, hor_markers, hor_symbols } = data;
|
|
|
hor_activeEdges && (this.activeEdges = hor_activeEdges);
|
|
|
if (hor_lines && Array.isArray(hor_lines)) {
|
|
|
this.renderLines = hor_lines;
|
|
@@ -594,10 +637,20 @@ export default class Player {
|
|
|
this.scene.scene.add(marker);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ if (hor_symbols && Array.isArray(hor_symbols)) {
|
|
|
+ this.renderSymbols = hor_symbols;
|
|
|
+ hor_symbols.forEach((syb) => {
|
|
|
+ console.log("pos");
|
|
|
+ const p = new THREE.Vector3().fromArray(syb.point);
|
|
|
+ const symbol = new CircleTextLabel(syb.index, p);
|
|
|
+ this.scene.scene.add(symbol);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (type === 2) {
|
|
|
- const { vir_activeEdges, vir_lines, vir_markers } = data;
|
|
|
+ const { vir_activeEdges, vir_lines, vir_markers, vir_symbols } = data;
|
|
|
vir_activeEdges && (this.activeEdges = vir_activeEdges);
|
|
|
if (vir_lines && Array.isArray(vir_lines)) {
|
|
|
this.renderLines = vir_lines;
|
|
@@ -614,6 +667,15 @@ export default class Player {
|
|
|
this.scene.scene.add(marker);
|
|
|
});
|
|
|
}
|
|
|
+ if (vir_symbols && Array.isArray(vir_symbols)) {
|
|
|
+ this.renderSymbols = vir_symbols;
|
|
|
+ vir_symbols.forEach((syb) => {
|
|
|
+ console.log("pos", syb);
|
|
|
+ const p = new THREE.Vector3().fromArray(syb.point);
|
|
|
+ const symbol = new CircleTextLabel(syb.index, p);
|
|
|
+ this.scene.scene.add(symbol);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
this.syncDrawData();
|
|
|
}
|