|
@@ -8,6 +8,7 @@ import Line from "../box/object/Line";
|
|
|
import LinePoints from "../box/object/LinePoints.js";
|
|
|
import Marker from "../box/object/marker.js";
|
|
|
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) {
|
|
@@ -38,6 +39,7 @@ export default class Player {
|
|
|
this.symbol = null;
|
|
|
this.symbolIndex = 0;
|
|
|
this.text = null;
|
|
|
+ this.showText = "文本";
|
|
|
this.selectItem = null;
|
|
|
|
|
|
this.drawing = false;
|
|
@@ -87,6 +89,10 @@ export default class Player {
|
|
|
let pos = new THREE.Vector3(0, 0, -1);
|
|
|
pos.unproject(this.orthCamera);
|
|
|
pos.y = 5;
|
|
|
+ this.text = new PureTextLabel(this.showText, true);
|
|
|
+ this.text.visible = false;
|
|
|
+ this.scene.scene.add(this.text);
|
|
|
+ this.drawing = true;
|
|
|
}
|
|
|
|
|
|
if (mode === 0) {
|
|
@@ -201,7 +207,6 @@ export default class Player {
|
|
|
let pos = new THREE.Vector3(this.pointermove.x, this.pointermove.y, -1);
|
|
|
pos.unproject(this.orthCamera);
|
|
|
pos.y = 5;
|
|
|
- // console.log("pos", pos);
|
|
|
this.marker.position.copy(pos);
|
|
|
}
|
|
|
}
|
|
@@ -212,11 +217,19 @@ export default class Player {
|
|
|
let pos = new THREE.Vector3(this.pointermove.x, this.pointermove.y, -1);
|
|
|
pos.unproject(this.orthCamera);
|
|
|
pos.y = 5;
|
|
|
- // console.log("pos", pos);
|
|
|
- // console.log("symbol", this.symbol);
|
|
|
this.symbol.position.copy(pos);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (this.mode === 4) {
|
|
|
+ if (this.text) {
|
|
|
+ this.text.visible = true;
|
|
|
+ let pos = new THREE.Vector3(this.pointermove.x, this.pointermove.y, -1);
|
|
|
+ pos.unproject(this.orthCamera);
|
|
|
+ pos.y = 5;
|
|
|
+ this.text.position.copy(pos);
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
onPointerDown = (e) => {
|
|
@@ -307,6 +320,23 @@ export default class Player {
|
|
|
this.setMode(0);
|
|
|
}
|
|
|
}
|
|
|
+ if (this.mode === 4) {
|
|
|
+ if (this.text) {
|
|
|
+ let lasPos = new THREE.Vector3(
|
|
|
+ this.pointerdown.x,
|
|
|
+ this.pointerdown.y,
|
|
|
+ -1
|
|
|
+ );
|
|
|
+ this.scene.emit("lockText");
|
|
|
+ this.drawing = false;
|
|
|
+ // const activeSymbolItem = {
|
|
|
+ // id: this.symbolIndex,
|
|
|
+ // point: lasPos.toArray(),
|
|
|
+ // };
|
|
|
+
|
|
|
+ // this.setMode(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
onPointerUp = (e) => {
|
|
|
this.pointerup = convertScreenToNDC(e, this.scene.domElement);
|