@realsee/dnalogel 3.48.6 → 3.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/dist/Sculpt/Meshes/Prism.d.ts +1 -0
- package/dist/index.cjs.js +30 -30
- package/dist/index.js +68 -72
- package/dist/index.umd.js +30 -30
- package/dist/shared-utils/Object3DHelper/Controller/RotateController.d.ts +0 -1
- package/dist/shared-utils/Object3DHelper/Controller/ScaleController.d.ts +1 -1
- package/dist/shared-utils/three/PointSelector/index.d.ts +2 -1
- package/dist/shared-utils/three/generatePolygonGeometry.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Controller/ViewController.js +32 -32
- package/libs/Sculpt/Meshes/Prism.d.ts +1 -0
- package/libs/Sculpt/Meshes/Prism.js +47 -37
- package/libs/Sculpt/index.js +1 -1
- package/libs/Sculpt/utils/Modules/Global.js +1 -1
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/Object3DHelper/Controller/MoveController.js +57 -57
- package/libs/shared-utils/Object3DHelper/Controller/RotateController.d.ts +0 -1
- package/libs/shared-utils/Object3DHelper/Controller/RotateController.js +91 -97
- package/libs/shared-utils/Object3DHelper/Controller/ScaleController.d.ts +1 -1
- package/libs/shared-utils/Object3DHelper/Controller/ScaleController.js +34 -31
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/three/PointSelector/index.d.ts +2 -1
- package/libs/shared-utils/three/generatePolygonGeometry.d.ts +1 -1
- package/libs/shared-utils/three/generatePolygonGeometry.js +8 -10
- package/package.json +1 -1
|
@@ -6,12 +6,13 @@ import { Subscribe } from '../../Subscribe';
|
|
|
6
6
|
import type { LiteralString } from '../../../typings/utils.type';
|
|
7
7
|
export type { PointIntersection };
|
|
8
8
|
export type ActionIfNoModelUnderMouse = LiteralString<'virtualPoint' | 'lastPoint' | 'disable'>;
|
|
9
|
+
type PointerSelectorMode = 'fixed' | 'cursor';
|
|
9
10
|
interface Config {
|
|
10
11
|
/**
|
|
11
12
|
* @description: 选点的两种模式, 'fixed' 为固定选点为屏幕中心点,拖动five画布来更新点,'cursor' 为跟随鼠标移动来更新点, 'auto' 则根据设备类型自动选择
|
|
12
13
|
* @default: 'auto'
|
|
13
14
|
*/
|
|
14
|
-
mode:
|
|
15
|
+
mode: PointerSelectorMode | 'auto';
|
|
15
16
|
/**
|
|
16
17
|
* @description 当鼠标位置没有模型时的行为
|
|
17
18
|
* ```markdown
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Vector3 } from 'three';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
4
|
+
* @description 根据多边形的顶点数组生成多边形的 BufferGeometry
|
|
5
5
|
* @param checkLinesIntersect 检查多边形边线是否相交,需要保证传入的顶点是有序的
|
|
6
6
|
*/
|
|
7
7
|
export default function generatePolygonGeometry(_points: Vector3[], config?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var r = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var s = (
|
|
2
|
+
var n = (a, o, i) => o in a ? r(a, o, { enumerable: !0, configurable: !0, writable: !0, value: i }) : a[o] = i;
|
|
3
|
+
var s = (a, o, i) => (n(a, typeof o != "symbol" ? o + "" : o, i), i);
|
|
4
4
|
import h from "hammerjs";
|
|
5
5
|
import v from "./BaseController.js";
|
|
6
6
|
import "three";
|
|
@@ -18,49 +18,49 @@ import "../../shared-utils/three/centerPoint.js";
|
|
|
18
18
|
import "../Model/point.js";
|
|
19
19
|
import "../utils/ironbox.js";
|
|
20
20
|
class R extends v {
|
|
21
|
-
constructor(
|
|
22
|
-
super(
|
|
21
|
+
constructor(i) {
|
|
22
|
+
super(i);
|
|
23
23
|
s(this, "type", "view");
|
|
24
24
|
s(this, "hammer");
|
|
25
|
-
s(this, "polylineRemoved", (
|
|
26
|
-
|
|
25
|
+
s(this, "polylineRemoved", (i) => {
|
|
26
|
+
i.lines.forEach((e) => this.removeLine(e)), this.hook.emit(
|
|
27
27
|
"selectedChange",
|
|
28
|
-
this.model.getAllLines().filter((
|
|
28
|
+
this.model.getAllLines().filter((e) => e.selected).map((e) => e)
|
|
29
29
|
);
|
|
30
30
|
});
|
|
31
|
-
s(this, "polylineAdded", (
|
|
32
|
-
const { panoIndex:
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
s(this, "polylineAdded", (i) => {
|
|
32
|
+
const { panoIndex: e, mode: t } = this.five.getCurrentState();
|
|
33
|
+
i.lines.forEach((d) => {
|
|
34
|
+
i.visibleFiveMode && !i.visibleFiveMode.includes(t) && (d.mesh.visible = !1), i.visiblePanoIndexes && !i.visiblePanoIndexes.includes(e) && (d.mesh.visible = !1), d.distanceItem.appendTo(this.container), d.distanceItem.update(this.five), this.group.add(d.mesh);
|
|
35
35
|
}), this.updateDistanceUI();
|
|
36
36
|
});
|
|
37
37
|
s(this, "onCameraUpdate", () => {
|
|
38
38
|
this.updateDistanceUI();
|
|
39
39
|
});
|
|
40
|
-
s(this, "onFiveModeChange", (
|
|
41
|
-
this.model.polylines.forEach((
|
|
42
|
-
|
|
40
|
+
s(this, "onFiveModeChange", (i) => {
|
|
41
|
+
i !== "Panorama" && (this.model.polylines.forEach((e) => {
|
|
42
|
+
e.visibleFiveMode && !e.visibleFiveMode.includes(i) && e.lines.forEach((t) => {
|
|
43
43
|
t.mesh.visible = !1, t.distanceItem.update(this.five);
|
|
44
|
-
})
|
|
44
|
+
});
|
|
45
45
|
}), this.five.ready().then(() => {
|
|
46
|
-
const
|
|
47
|
-
this.model.polylines.forEach((t) => {
|
|
48
|
-
t.visibleFiveMode && t.visibleFiveMode.includes(
|
|
46
|
+
const e = this.five.getCurrentState().mode;
|
|
47
|
+
e !== "Panorama" && this.model.polylines.forEach((t) => {
|
|
48
|
+
t.visibleFiveMode && t.visibleFiveMode.includes(e) && t.lines.forEach((d) => {
|
|
49
49
|
d.mesh.visible = !0, d.distanceItem.update(this.five);
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
|
-
});
|
|
52
|
+
}));
|
|
53
53
|
});
|
|
54
|
-
s(this, "onFivePanoWillArrive", (
|
|
55
|
-
this.model.polylines.forEach((
|
|
56
|
-
|
|
54
|
+
s(this, "onFivePanoWillArrive", (i) => {
|
|
55
|
+
this.model.polylines.forEach((e) => {
|
|
56
|
+
(e.visiblePanoIndexes && !e.visiblePanoIndexes.includes(i) || e.visibleFiveMode && !e.visibleFiveMode.includes(this.five.getCurrentState().mode)) && e.lines.forEach((t) => {
|
|
57
57
|
t.mesh.visible = !1, t.distanceItem.update(this.five);
|
|
58
|
-
})
|
|
58
|
+
});
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
s(this, "onFivePanoArrived", (
|
|
62
|
-
this.model.polylines.forEach((
|
|
63
|
-
|
|
61
|
+
s(this, "onFivePanoArrived", (i) => {
|
|
62
|
+
this.model.polylines.forEach((e) => {
|
|
63
|
+
e.visiblePanoIndexes && e.visiblePanoIndexes.includes(i) && e.visibleFiveMode && e.visibleFiveMode.includes(this.five.getCurrentState().mode) && e.lines.forEach((t) => {
|
|
64
64
|
t.mesh.visible = !0, t.distanceItem.update(this.five);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
@@ -68,16 +68,16 @@ class R extends v {
|
|
|
68
68
|
this.model.getAllLines().forEach((t) => {
|
|
69
69
|
t.distanceItem.appendTo(this.container), t.distanceItem.update(this.five), this.group.add(t.mesh), t.mesh.updateMatrixWorld();
|
|
70
70
|
});
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const t = new h(
|
|
71
|
+
const e = this.five.getElement();
|
|
72
|
+
if (e) {
|
|
73
|
+
const t = new h(e);
|
|
74
74
|
this.hammer = t;
|
|
75
75
|
}
|
|
76
|
-
this.
|
|
76
|
+
this.onFiveModeChange(this.five.getCurrentState().mode), this.onFivePanoWillArrive(this.five.getCurrentState().panoIndex), this.onFivePanoArrived(this.five.getCurrentState().panoIndex), this.updateDistanceUI(), this.five.needsRender = !0, this.model.hook.on("polylineAdded", this.polylineAdded), this.model.hook.on("polylineRemoved", this.polylineRemoved), this.five.on("cameraUpdate", this.onCameraUpdate), this.five.on("panoArrived", this.onFivePanoArrived), this.five.on("modeChange", this.onFiveModeChange), this.five.on("panoWillArrive", this.onFivePanoWillArrive);
|
|
77
77
|
}
|
|
78
78
|
dispose() {
|
|
79
|
-
var
|
|
80
|
-
super.dispose(), this.model.hook.off("polylineAdded", this.polylineAdded), this.model.hook.off("polylineRemoved", this.polylineRemoved), this.five.off("cameraUpdate", this.onCameraUpdate), this.five.off("panoArrived", this.onFivePanoArrived), this.five.off("modeChange", this.onFiveModeChange), this.five.off("panoWillArrive", this.onFivePanoWillArrive), this.five.needsRender = !0, this.hook.emit("selectedChange", []), (
|
|
79
|
+
var i;
|
|
80
|
+
super.dispose(), this.model.hook.off("polylineAdded", this.polylineAdded), this.model.hook.off("polylineRemoved", this.polylineRemoved), this.five.off("cameraUpdate", this.onCameraUpdate), this.five.off("panoArrived", this.onFivePanoArrived), this.five.off("modeChange", this.onFiveModeChange), this.five.off("panoWillArrive", this.onFivePanoWillArrive), this.five.needsRender = !0, this.hook.emit("selectedChange", []), (i = this.hammer) == null || i.destroy();
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
export {
|
|
@@ -26,6 +26,7 @@ export declare class PrismMesh extends IObject3D {
|
|
|
26
26
|
get color(): THREE.Color;
|
|
27
27
|
get lineWidth(): number;
|
|
28
28
|
get lineColor(): THREE.Color;
|
|
29
|
+
paramStyle: Partial<PrismStyle>;
|
|
29
30
|
private edgePlanes;
|
|
30
31
|
constructor(params?: Partial<PrismData & PrismStyle>);
|
|
31
32
|
setStyle(params: Partial<PrismStyle>): void;
|
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var m = Object.getOwnPropertySymbols;
|
|
3
|
+
var E = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var g = (n, o, t) => o in n ? b(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t, P = (n, o) => {
|
|
5
|
+
for (var t in o || (o = {}))
|
|
6
|
+
E.call(o, t) && g(n, t, o[t]);
|
|
7
|
+
if (m)
|
|
8
|
+
for (var t of m(o))
|
|
9
|
+
C.call(o, t) && g(n, t, o[t]);
|
|
10
|
+
return n;
|
|
11
|
+
};
|
|
12
|
+
var h = (n, o, t) => (g(n, typeof o != "symbol" ? o + "" : o, t), t);
|
|
13
|
+
import { IObject3D as c } from "../../shared-utils/three/IObject3D.js";
|
|
14
|
+
import { anyPositionToVector3 as a } from "../../shared-utils/positionToVector3.js";
|
|
15
|
+
import * as p from "three";
|
|
7
16
|
import "hammerjs";
|
|
8
17
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
9
|
-
import { LineMesh as
|
|
18
|
+
import { LineMesh as y } from "./Line.js";
|
|
10
19
|
import "../../shared-utils/three/THREESphere.js";
|
|
11
20
|
import "animejs";
|
|
12
|
-
import { notNil as
|
|
21
|
+
import { notNil as f } from "../../shared-utils/isNil.js";
|
|
13
22
|
import "../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
14
|
-
import { PolygonMesh as
|
|
15
|
-
import { PolygonWithEdgeMesh as
|
|
16
|
-
import { intersectWithoutLine as
|
|
17
|
-
class
|
|
23
|
+
import { PolygonMesh as d } from "./Polygon.js";
|
|
24
|
+
import { PolygonWithEdgeMesh as u } from "./PolygonWithEdge.js";
|
|
25
|
+
import { intersectWithoutLine as S } from "../../shared-utils/three/THREERaycaster.js";
|
|
26
|
+
class z extends c {
|
|
18
27
|
constructor(t) {
|
|
19
28
|
super();
|
|
20
29
|
h(this, "name", "PrismMesh");
|
|
21
30
|
h(this, "heightPoint");
|
|
22
|
-
h(this, "bottomPolygon", new
|
|
23
|
-
h(this, "topPolygon", new
|
|
24
|
-
h(this, "
|
|
31
|
+
h(this, "bottomPolygon", new u());
|
|
32
|
+
h(this, "topPolygon", new u());
|
|
33
|
+
h(this, "paramStyle");
|
|
34
|
+
h(this, "edgePlanes", new c());
|
|
25
35
|
this.topPolygon.name = "TopPolygon", this.bottomPolygon.name = "BottomPolygon", this.edgePlanes.name = "EdgePlanes", this.addIfNotExists(this.bottomPolygon), t && this.setPoints(t), t && this.setStyle(t);
|
|
26
36
|
}
|
|
27
37
|
/**
|
|
@@ -31,10 +41,10 @@ class L extends g {
|
|
|
31
41
|
return this.localCenter;
|
|
32
42
|
}
|
|
33
43
|
get localCenter() {
|
|
34
|
-
var
|
|
35
|
-
const t = (
|
|
36
|
-
if (t &&
|
|
37
|
-
return new
|
|
44
|
+
var s, i;
|
|
45
|
+
const t = (s = this.topPolygon) == null ? void 0 : s.center, e = (i = this.bottomPolygon) == null ? void 0 : i.center;
|
|
46
|
+
if (t && e)
|
|
47
|
+
return new p.Vector3().lerpVectors(t, e, 0.5);
|
|
38
48
|
}
|
|
39
49
|
get worldCenter() {
|
|
40
50
|
return this.updateMatrixWorld(), this.localToWorld(this.localCenter);
|
|
@@ -49,12 +59,12 @@ class L extends g {
|
|
|
49
59
|
return this.bottomPolygon.lineColor;
|
|
50
60
|
}
|
|
51
61
|
setStyle(t) {
|
|
52
|
-
this.bottomPolygon.setStyle(
|
|
53
|
-
(
|
|
62
|
+
this.paramStyle = P(P({}, this.paramStyle), t), this.bottomPolygon.setStyle(this.paramStyle), this.topPolygon.setStyle(this.paramStyle), this.edgePlanes.children.forEach((e) => {
|
|
63
|
+
(e instanceof y || e instanceof d) && e.setStyle(this.paramStyle);
|
|
54
64
|
});
|
|
55
65
|
}
|
|
56
66
|
setPoints(t) {
|
|
57
|
-
|
|
67
|
+
f(t.points) && this.setBottomPoints(t.points), f(t.heightPoint) && this.setTopHeightPoint(a(t.heightPoint));
|
|
58
68
|
}
|
|
59
69
|
highlight() {
|
|
60
70
|
this.bottomPolygon.highlight(), this.topPolygon.highlight(), this.edgePlanes.children.forEach((t) => {
|
|
@@ -67,32 +77,32 @@ class L extends g {
|
|
|
67
77
|
});
|
|
68
78
|
}
|
|
69
79
|
setBottomPoints(t) {
|
|
70
|
-
this.bottomPolygon.setPoints(t.map(
|
|
80
|
+
this.bottomPolygon.setPoints(t.map(a)), this.heightPoint && this.setTopHeightPoint(this.heightPoint);
|
|
71
81
|
}
|
|
72
82
|
setTopHeightPoint(t) {
|
|
73
83
|
this.heightPoint = t, this.addIfNotExists(this.topPolygon);
|
|
74
|
-
const
|
|
75
|
-
this.up.copy(
|
|
76
|
-
const r = this.bottomPolygon.points.map((l) => l.clone().add(
|
|
84
|
+
const e = this.bottomPolygon.projectPoint(t), s = new p.Vector3().subVectors(t, e);
|
|
85
|
+
this.up.copy(s.clone().normalize());
|
|
86
|
+
const r = this.bottomPolygon.points.map((l) => l.clone().add(s));
|
|
77
87
|
this.topPolygon.setPoints(r), this.setEdgePlanes();
|
|
78
88
|
}
|
|
79
|
-
raycast(t,
|
|
80
|
-
return this.children.forEach((
|
|
81
|
-
|
|
89
|
+
raycast(t, e) {
|
|
90
|
+
return this.children.forEach((s) => {
|
|
91
|
+
S(s, t, e, !0);
|
|
82
92
|
}), !1;
|
|
83
93
|
}
|
|
84
94
|
setEdgePlanes() {
|
|
85
|
-
const t = this.bottomPolygon.points,
|
|
86
|
-
this.addIfNotExists(this.edgePlanes), this.edgePlanes.removeChildren(), t.forEach((
|
|
87
|
-
if (
|
|
95
|
+
const t = this.bottomPolygon.points, e = this.topPolygon.points;
|
|
96
|
+
this.addIfNotExists(this.edgePlanes), this.edgePlanes.removeChildren(), t.forEach((s, i) => {
|
|
97
|
+
if (i === 0)
|
|
88
98
|
return;
|
|
89
|
-
const r = new
|
|
90
|
-
r.setPoints([t[
|
|
91
|
-
const l = new
|
|
92
|
-
l.name = "EdgeLine", l.setPoints([t[
|
|
99
|
+
const r = new d({ color: this.color });
|
|
100
|
+
r.setPoints([t[i - 1], t[i], e[i], e[i - 1]]);
|
|
101
|
+
const l = new y({ lineColor: this.lineColor, lineWidth: this.lineWidth });
|
|
102
|
+
l.name = "EdgeLine", l.setPoints([t[i - 1], e[i - 1]]), this.edgePlanes.add(r, l);
|
|
93
103
|
});
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
export {
|
|
97
|
-
|
|
107
|
+
z as PrismMesh
|
|
98
108
|
};
|
package/libs/Sculpt/index.js
CHANGED
|
@@ -76,7 +76,7 @@ const a = class extends S {
|
|
|
76
76
|
var s;
|
|
77
77
|
const l = H((s = n == null ? void 0 : n[0]) == null ? void 0 : s.object, (o) => o.isSculptObject);
|
|
78
78
|
return l ? this.emit("click", l) : !1;
|
|
79
|
-
}), window.
|
|
79
|
+
}), window.__SCULPT_DEBUG__ = this, window.__SCULPT_MODULES_DEBUG__ = a.modules;
|
|
80
80
|
}
|
|
81
81
|
get data() {
|
|
82
82
|
return {
|
|
@@ -25,7 +25,7 @@ class f {
|
|
|
25
25
|
get pointSelector() {
|
|
26
26
|
if (!this.inited)
|
|
27
27
|
throw new Error("Global not inited");
|
|
28
|
-
return this._pointSelector ? this._pointSelector : (this._pointSelector = new c(this.five), this._pointSelector);
|
|
28
|
+
return this._pointSelector ? this._pointSelector : (this._pointSelector = new c(this.five, { mode: "cursor" }), this._pointSelector);
|
|
29
29
|
}
|
|
30
30
|
get fiveDomEvents() {
|
|
31
31
|
if (!this.inited)
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,25 +1,61 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BaseController as
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var f = (c, a, e) => a in c ? v(c, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[a] = e;
|
|
3
|
+
var r = (c, a, e) => (f(c, typeof a != "symbol" ? a + "" : a, e), e);
|
|
4
|
+
import { BaseController as g } from "../Base/BaseController.js";
|
|
5
5
|
import * as m from "three";
|
|
6
|
-
import { getMouseRaycaster as
|
|
6
|
+
import { getMouseRaycaster as p } from "../utils/getMouseRaycaster.js";
|
|
7
7
|
import { rayOnLine as y } from "../../../Sculpt/utils/three/rayOnLine.js";
|
|
8
|
-
class w extends
|
|
8
|
+
class w extends g {
|
|
9
9
|
constructor(...e) {
|
|
10
10
|
super(...e);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
r(this, "name", "MoveController");
|
|
12
|
+
r(this, "startInfo");
|
|
13
|
+
r(this, "_moveByMouse", {
|
|
14
14
|
enabled: !1
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
r(this, "mouseInfo");
|
|
17
|
+
r(this, "mousedownEventListenerDisposer");
|
|
18
|
+
/**
|
|
19
|
+
* @description: 拖动开始,找出拖的Direction
|
|
20
|
+
*/
|
|
21
|
+
r(this, "dragStart", (e) => {
|
|
22
|
+
if (this.moveByMouseEnable || this.isDragging)
|
|
23
|
+
return;
|
|
24
|
+
const t = e == null ? void 0 : e.intersect;
|
|
25
|
+
if (!t)
|
|
26
|
+
return this.dragEnd();
|
|
27
|
+
const o = (t == null ? void 0 : t.object).direction;
|
|
28
|
+
if (!o)
|
|
29
|
+
return this.dragEnd();
|
|
30
|
+
const s = new m.Vector3(1, 0, 0).applyQuaternion(this.helperObject3D.quaternion), h = new m.Vector3(0, 1, 0).applyQuaternion(this.helperObject3D.quaternion), u = new m.Vector3(0, 0, 1).applyQuaternion(this.helperObject3D.quaternion), n = (() => {
|
|
31
|
+
switch (o) {
|
|
32
|
+
case "x":
|
|
33
|
+
return s;
|
|
34
|
+
case "y":
|
|
35
|
+
return h;
|
|
36
|
+
case "z":
|
|
37
|
+
return u;
|
|
38
|
+
}
|
|
39
|
+
})(), i = t.point.clone(), d = new m.Line3(
|
|
40
|
+
i.clone().sub(n.normalize()),
|
|
41
|
+
i.clone().add(n.normalize())
|
|
42
|
+
);
|
|
43
|
+
this.startInfo = { startVectorProject: i, line: d }, this.helperObject3D.showDraggingHelper([o]), this.hooks.emit("moveStart"), this.isDragging = !0;
|
|
44
|
+
});
|
|
45
|
+
r(this, "dragging", (e) => {
|
|
46
|
+
if (!this.isDragging || !this.startInfo)
|
|
47
|
+
return;
|
|
48
|
+
const t = "touches" in e ? e.touches[0].clientX : e.x, o = "touches" in e ? e.touches[0].clientY : e.y, s = p(this.camera, { x: t, y: o }, this.container);
|
|
49
|
+
return s ? (this.move(s), !1) : this.dragEnd();
|
|
50
|
+
});
|
|
51
|
+
r(this, "dragEnd", () => {
|
|
52
|
+
this.isDragging && (this.startInfo = void 0, this.isDragging = !1, this.helperObject3D.show(), this.hooks.emit("moveEnd"));
|
|
53
|
+
});
|
|
18
54
|
const t = this.helperObject3D;
|
|
19
55
|
this.hoverListener([t.xArrow, t.yArrow, t.zArrow]);
|
|
20
|
-
const o = this.
|
|
21
|
-
this.domEvents.addEventListener(this.helperObject3D, "mousedown",
|
|
22
|
-
this.domEvents.removeEventListener(this.helperObject3D, "mousedown",
|
|
56
|
+
const o = this.show.bind(this), s = this.hide.bind(this);
|
|
57
|
+
this.domEvents.addEventListener(this.helperObject3D, "mousedown", this.dragStart), document.addEventListener("mousemove", this.dragging), document.addEventListener("mouseup", this.dragEnd), this.domEvents.addEventListener(this.helperObject3D, "touchstart", this.dragStart), document.addEventListener("touchmove", this.dragging), document.addEventListener("touchend", this.dragEnd), this.hooks.on("rotateStart", s), this.hooks.on("rotateEnd", o), this.hooks.on("scaleStart", s), this.hooks.on("scaleEnd", o), this.hooks.on("moveByMouseEnable", s), this.hooks.on("moveByMouseDisable", o), this.disposers.push(() => {
|
|
58
|
+
this.domEvents.removeEventListener(this.helperObject3D, "mousedown", this.dragStart), document.removeEventListener("mousemove", this.dragging), document.removeEventListener("mouseup", this.dragEnd), this.domEvents.removeEventListener(this.helperObject3D, "touchstart", this.dragStart), document.removeEventListener("touchmove", this.dragging), document.removeEventListener("touchend", this.dragEnd), this.hooks.off("rotateStart", s), this.hooks.off("rotateEnd", o), this.hooks.off("scaleStart", s), this.hooks.off("scaleEnd", o), this.hooks.off("moveByMouseEnable", s), this.hooks.off("moveByMouseDisable", o);
|
|
23
59
|
}), this.moveByMouseEnable && this.moveByMouse();
|
|
24
60
|
}
|
|
25
61
|
get moveByMouseEnable() {
|
|
@@ -53,14 +89,14 @@ class w extends p {
|
|
|
53
89
|
this._moveByMouse = { enabled: !1 }, this.preventTapDefaultEvent = !1, this.hooks.emit("moveByMouseDisable"), (e = this.mousedownEventListenerDisposer) == null || e.call(this);
|
|
54
90
|
}
|
|
55
91
|
onIntersectionOnModelUpdate(e) {
|
|
56
|
-
var
|
|
92
|
+
var h, u, n;
|
|
57
93
|
if (!this.moveByMouseEnable)
|
|
58
94
|
return;
|
|
59
95
|
const { point: t, face: o } = e;
|
|
60
96
|
if (!this.hooks.emit("wantToMove", t)) {
|
|
61
97
|
if (this.originObject3D.position.copy(t), (this._moveByMouse.useFaceNormal === !0 || typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.enable !== !1) && o != null && o.normal) {
|
|
62
|
-
const
|
|
63
|
-
this.originObject3D.quaternion.setFromUnitVectors(
|
|
98
|
+
const i = (() => typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.alignmentVector ? this._moveByMouse.useFaceNormal.alignmentVector : { x: 0, y: 1, z: 0 })(), d = new m.Vector3((h = i.x) != null ? h : 0, (u = i.y) != null ? u : 0, (n = i.z) != null ? n : 0), l = (() => typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.fixedFaceNormal ? this._moveByMouse.useFaceNormal.fixedFaceNormal(o.normal) : o.normal)();
|
|
99
|
+
this.originObject3D.quaternion.setFromUnitVectors(d, l), this.internalHooks.emit("setObjectRotate", this.originObject3D.quaternion.clone());
|
|
64
100
|
}
|
|
65
101
|
this.internalHooks.emit("setObjectPosition", t), this.hooks.emit("move", t);
|
|
66
102
|
}
|
|
@@ -75,49 +111,13 @@ class w extends p {
|
|
|
75
111
|
const { x: t, y: o } = e;
|
|
76
112
|
this.mouseInfo.x === t && this.mouseInfo.y === o && Date.now() - this.mouseInfo.mouseDownTimestamp < 500 && (this.disableMoveByMouse(), this.mouseInfo = void 0);
|
|
77
113
|
}
|
|
78
|
-
/**
|
|
79
|
-
* @description: 拖动开始,找出拖的Direction
|
|
80
|
-
*/
|
|
81
|
-
dragStart(e) {
|
|
82
|
-
if (this.moveByMouseEnable || this.isDragging)
|
|
83
|
-
return;
|
|
84
|
-
const t = e == null ? void 0 : e.intersect;
|
|
85
|
-
if (!t)
|
|
86
|
-
return this.dragEnd();
|
|
87
|
-
const o = (t == null ? void 0 : t.object).direction;
|
|
88
|
-
if (!o)
|
|
89
|
-
return this.dragEnd();
|
|
90
|
-
const h = new m.Vector3(1, 0, 0).applyQuaternion(this.helperObject3D.quaternion), i = new m.Vector3(0, 1, 0).applyQuaternion(this.helperObject3D.quaternion), n = new m.Vector3(0, 0, 1).applyQuaternion(this.helperObject3D.quaternion), s = (() => {
|
|
91
|
-
switch (o) {
|
|
92
|
-
case "x":
|
|
93
|
-
return h;
|
|
94
|
-
case "y":
|
|
95
|
-
return i;
|
|
96
|
-
case "z":
|
|
97
|
-
return n;
|
|
98
|
-
}
|
|
99
|
-
})(), r = t.point.clone(), l = new m.Line3(
|
|
100
|
-
r.clone().sub(s.normalize()),
|
|
101
|
-
r.clone().add(s.normalize())
|
|
102
|
-
);
|
|
103
|
-
this.startInfo = { startVectorProject: r, line: l }, this.helperObject3D.showDraggingHelper([o]), this.hooks.emit("moveStart"), this.isDragging = !0;
|
|
104
|
-
}
|
|
105
|
-
dragging(e) {
|
|
106
|
-
if (!this.isDragging || !this.startInfo)
|
|
107
|
-
return;
|
|
108
|
-
const t = g(this.camera, e, this.container);
|
|
109
|
-
return t ? (this.move(t), !1) : this.dragEnd();
|
|
110
|
-
}
|
|
111
114
|
move(e) {
|
|
112
115
|
if (!this.startInfo)
|
|
113
116
|
return this.dragEnd();
|
|
114
|
-
const { line: t, startVectorProject: o } = this.startInfo,
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
this.hooks.emit("wantToMove",
|
|
118
|
-
}
|
|
119
|
-
dragEnd() {
|
|
120
|
-
this.isDragging && (this.startInfo = void 0, this.isDragging = !1, this.helperObject3D.show(), this.hooks.emit("moveEnd"));
|
|
117
|
+
const { line: t, startVectorProject: o } = this.startInfo, s = this.originObject3D, h = y({ raycaster: e, line: t, clampToLine: !1 }), u = h.clone().sub(o), n = new m.Matrix4();
|
|
118
|
+
n.setPosition(u);
|
|
119
|
+
const i = s.position.clone().applyMatrix4(n);
|
|
120
|
+
this.hooks.emit("wantToMove", i) || (s.applyMatrix4(n), o.copy(h), this.internalHooks.emit("applyObjectPosition", { matrix: n }), this.hooks.emit("move", i));
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
export {
|