ss-component-new 1.1.428 → 1.1.430
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/dist/{array-C4Es3IJl.cjs → array-BE8kxwbF.cjs} +1 -1
- package/dist/{array-CfYKb4Nd.js → array-CmTW1wXQ.js} +1 -1
- package/dist/icons/svg/EyeFill.svg +1 -0
- package/dist/{index-jteGdz9o.js → index-B3sv--5l.js} +9 -9
- package/dist/{index-DGftdu10.cjs → index-B8ONEgpW.cjs} +1 -1
- package/dist/{index-CRfrrpPf.cjs → index-BCFtIIf_.cjs} +1 -1
- package/dist/{index-B5T_VqYF.js → index-BWHERznY.js} +4 -4
- package/dist/{index-CTvJr4hu.cjs → index-BZkQ29Tz.cjs} +1 -1
- package/dist/{index-EYlNG37M.cjs → index-B_AUqKy_.cjs} +1 -1
- package/dist/{index-CkZ55Trw.cjs → index-Bb7GoIJp.cjs} +1 -1
- package/dist/{index-CjSdK9n3.js → index-BiuhwvlL.js} +9 -9
- package/dist/{index-AELMbDVd.js → index-BnlhM9YS.js} +7 -7
- package/dist/{index-Bp9OCGp9.js → index-BwhVhBYj.js} +5 -5
- package/dist/index-C-jjWrUl.cjs +1 -0
- package/dist/{index-l4f4Ksrs.js → index-CMBrDaM5.js} +1 -1
- package/dist/{index-BNZtQgpp.cjs → index-CNpklHzK.cjs} +1 -1
- package/dist/{index-UZsDwc9I.cjs → index-CONyMR2I.cjs} +1 -1
- package/dist/{index-Ct43M3Ia.js → index-CSj1osh5.js} +6 -6
- package/dist/{index-Dxporpi3.js → index-CYOSbBn4.js} +212 -219
- package/dist/{index-C76WZoJF.cjs → index-CjlMUufz.cjs} +1 -1
- package/dist/{index-BTQXT09h.cjs → index-Clor83sA.cjs} +1 -1
- package/dist/{index-HOLtxrWE.cjs → index-CqaFuVhy.cjs} +1 -1
- package/dist/{index-UiIVwT0x.js → index-Cqd4dRu7.js} +4 -4
- package/dist/{index-DdlG0SsL.js → index-CrtuDvMe.js} +1 -1
- package/dist/{index-6I-wNfSX.cjs → index-CsHPoVQL.cjs} +1 -1
- package/dist/{index-Ct6CbWll.js → index-CzfGrSpV.js} +1 -1
- package/dist/{index-B0jpwR-h.cjs → index-D2aIlMCu.cjs} +1 -1
- package/dist/{index-CMYViTL8.cjs → index-D3ah-UXX.cjs} +1 -1
- package/dist/{index-BN5V2XDK.cjs → index-D5JRjtWD.cjs} +1 -1
- package/dist/{index-B1B8QwCz.cjs → index-D6iTzH06.cjs} +1 -1
- package/dist/{index-DNxPzGNN.js → index-DDoTCY3C.js} +5 -5
- package/dist/{index-BJ4skhum.js → index-DFilfUFX.js} +3 -3
- package/dist/{index-CjUuYXN_.cjs → index-DIxSv5u4.cjs} +1 -1
- package/dist/{index-C6jLxi8v.cjs → index-DOm1fXtU.cjs} +1 -1
- package/dist/{index-BqXldRGs.js → index-DQq3rsff.js} +5 -5
- package/dist/{index-DxH1id_m.cjs → index-DUPkZILz.cjs} +1 -1
- package/dist/{index-BBCbfygK.js → index-DXtXtduX.js} +4 -4
- package/dist/{index-B4PppAMz.cjs → index-D_j7_Hn_.cjs} +1 -1
- package/dist/index-Daqdy9e9.js +20924 -0
- package/dist/{index-DnL48cUW.js → index-DeXnZk4X.js} +6 -6
- package/dist/{index-DN77Gqf7.js → index-Di1ajNKI.js} +4 -4
- package/dist/{index-Ds17eX5X.js → index-DkiBGvqU.js} +1 -1
- package/dist/{index-DMQYdu7x.js → index-DxCiQhlC.js} +2 -2
- package/dist/{index-BshhtCGw.cjs → index-DxNyBY1w.cjs} +1 -1
- package/dist/{index-C8hk7atl.cjs → index-DygfoHkC.cjs} +1 -1
- package/dist/{index-CYd3fvF0.js → index-EzZiR3ly.js} +4 -4
- package/dist/{index-D7yRWMe9.js → index-LoH8EwXA.js} +3 -3
- package/dist/{index-CiC0L55k.cjs → index-N9Y_z5k_.cjs} +1 -1
- package/dist/{index-Dn-Jaifm.cjs → index-PdwN7EaB.cjs} +1 -1
- package/dist/{index-CHHBmFWf.js → index-eH2F0oMQ.js} +3 -3
- package/dist/index-gXA0eS6O.cjs +15 -0
- package/dist/{index-B8_cYT3O.cjs → index-o5dof3CA.cjs} +1 -1
- package/dist/{index-BSQfr-21.js → index-pvjM6t0d.js} +6 -6
- package/dist/{index-Lr-jM5BD.js → index-qEFkFDy8.js} +7 -7
- package/dist/{index-CiiImREt.js → index-uatggqnf.js} +5 -5
- package/dist/{index.vue_vue_type_script_setup_true_lang-3lAQFpGt.cjs → index.vue_vue_type_script_setup_true_lang-EaaJleWP.cjs} +1 -1
- package/dist/{index.vue_vue_type_script_setup_true_lang-AQDB--lA.js → index.vue_vue_type_script_setup_true_lang-YlUeUQJ4.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C2oFMwa6.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bw_ydbnW.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-XVUNtATu.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CClJxB6F.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_ed9fe0f5_lang-DuQ2lr1u.cjs → index.vue_vue_type_style_index_0_scoped_ed9fe0f5_lang-B2duMdZT.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_ed9fe0f5_lang-CPssMJ2M.js → index.vue_vue_type_style_index_0_scoped_ed9fe0f5_lang-CcYfjXoA.js} +8 -8
- package/dist/index.vue_vue_type_style_index_0_scoped_f69cf49c_lang-TQjM60R4.js +1947 -0
- package/dist/index.vue_vue_type_style_index_0_scoped_f69cf49c_lang-Z8fBYrL9.cjs +1 -0
- package/dist/{login-CcYUrJ0A.js → login-B520hsEu.js} +1 -1
- package/dist/{login-Cf3T6tgq.cjs → login-BMAi9yYX.cjs} +1 -1
- package/dist/{main-B3iC_GFY.js → main-Dpbg9Pxc.js} +6 -6
- package/dist/{main-3IJiaVcX.cjs → main-yzKa6bxy.cjs} +1 -1
- package/dist/{menu-DBX0QxSF.cjs → menu-BAEUpxbd.cjs} +1 -1
- package/dist/{menu-DBnQNYlq.js → menu-qAL8FiSW.js} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +2 -2
- package/dist/ss-component.js +10 -10
- package/dist/ss-component3.cjs +1 -1
- package/dist/ss-component3.js +1 -1
- package/dist/{threeModel-BJTtjg6F.js → threeModel-ClGUp5fG.js} +639 -763
- package/dist/threeModel-CxKWxMlL.cjs +1 -0
- package/dist/{threeModel.vue_vue_type_style_index_0_scoped_e7dd7d83_lang-C3w6_nGz.cjs → threeModel.vue_vue_type_style_index_0_scoped_3e87dec6_lang-BOT5Tivd.cjs} +181 -181
- package/dist/{threeModel.vue_vue_type_style_index_0_scoped_e7dd7d83_lang-bdUv7Wu8.js → threeModel.vue_vue_type_style_index_0_scoped_3e87dec6_lang-DYhzYEGg.js} +4567 -5349
- package/package.json +5 -1
- package/public/icons/svg/EyeFill.svg +1 -0
- package/dist/index-Cz3Bar44.cjs +0 -1
- package/dist/index-D55Us6td.js +0 -2782
- package/dist/index-W-mzocaB.cjs +0 -4
- package/dist/index.vue_vue_type_style_index_0_scoped_7ee96c6e_lang-D684C3wt.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_7ee96c6e_lang-iXOYIk8v.js +0 -1929
- package/dist/threeModel-nm_sKExW.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { C as
|
|
3
|
-
import { _ as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as wt, resolveComponent as Rt, createElementBlock as j, openBlock as z, createVNode as B, ref as D, computed as Ht, watch as Bt, onMounted as Et, onUnmounted as jt, Fragment as ut, createElementVNode as p, toDisplayString as Y, renderList as It, createCommentVNode as q, normalizeClass as pt, normalizeStyle as Ft, nextTick as Nt, onBeforeUnmount as Ut, withDirectives as X, unref as A, withCtx as mt, createBlock as Gt, isRef as et, vModelRadio as it, vShow as ft } from "vue";
|
|
2
|
+
import { C as Yt, V as y, M as $, T as W, Q as gt, S as yt, a as U, R as Vt, P as nt, b as Zt, B as st, c as $t, d as Kt, e as Xt, W as Wt, f as qt, A as Qt, g as te, X as ee, G as ie, h as at, i as oe, j as Dt, k as ne, D as rt, H as ae, l as bt, m as se, n as re, E as lt, _ as le, o as he } from "./threeModel.vue_vue_type_style_index_0_scoped_3e87dec6_lang-DYhzYEGg.js";
|
|
3
|
+
import { _ as Q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
const de = { class: "tree-container" }, _e = /* @__PURE__ */ wt({
|
|
5
5
|
__name: "index",
|
|
6
6
|
props: {
|
|
7
7
|
treeData: Array,
|
|
@@ -11,102 +11,76 @@ const Ee = { class: "tree-container" }, xe = /* @__PURE__ */ Nt({
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
emits: ["nodeClick"],
|
|
14
|
-
setup(
|
|
15
|
-
const e = t, i =
|
|
14
|
+
setup(o, { emit: t }) {
|
|
15
|
+
const e = t, i = o, l = {
|
|
16
16
|
children: "children",
|
|
17
17
|
label: "label"
|
|
18
|
-
},
|
|
19
|
-
e("nodeClick",
|
|
18
|
+
}, u = (s) => {
|
|
19
|
+
e("nodeClick", s);
|
|
20
20
|
};
|
|
21
|
-
return (
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
|
|
21
|
+
return (s, a) => {
|
|
22
|
+
const f = Rt("el-tree");
|
|
23
|
+
return z(), j("div", de, [
|
|
24
|
+
B(f, {
|
|
25
25
|
data: i == null ? void 0 : i.treeData,
|
|
26
|
-
props:
|
|
27
|
-
"default-expand-all":
|
|
28
|
-
onNodeClick:
|
|
26
|
+
props: l,
|
|
27
|
+
"default-expand-all": o.expand,
|
|
28
|
+
onNodeClick: u
|
|
29
29
|
}, null, 8, ["data", "default-expand-all"])
|
|
30
30
|
]);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
}),
|
|
34
|
-
key: 0,
|
|
35
|
-
class: "jointPanel-container"
|
|
36
|
-
}, Se = { class: "panel-content" }, Ae = /* @__PURE__ */ Nt({
|
|
33
|
+
}), ce = /* @__PURE__ */ Q(_e, [["__scopeId", "data-v-b4bd4658"]]), Pe = { class: "panel-content" }, Je = /* @__PURE__ */ wt({
|
|
37
34
|
__name: "robotMenu",
|
|
38
35
|
props: {
|
|
39
36
|
model: Object
|
|
40
37
|
},
|
|
41
|
-
setup(
|
|
42
|
-
const t =
|
|
43
|
-
const
|
|
44
|
-
return Array.isArray(
|
|
45
|
-
if (!(
|
|
46
|
-
const
|
|
47
|
-
name:
|
|
48
|
-
label:
|
|
38
|
+
setup(o) {
|
|
39
|
+
const t = o, e = D([]), i = (s, a = 0) => {
|
|
40
|
+
const f = [];
|
|
41
|
+
return Array.isArray(s) && (s == null ? void 0 : s.length) > 0 && s.forEach((h) => {
|
|
42
|
+
if (!(h != null && h.isMesh) && ((h == null ? void 0 : h.type) === "URDFJoint" || (h == null ? void 0 : h.type) === "URDFLink")) {
|
|
43
|
+
const x = {
|
|
44
|
+
name: h == null ? void 0 : h.name,
|
|
45
|
+
label: h == null ? void 0 : h.name,
|
|
49
46
|
show: !0,
|
|
50
|
-
level:
|
|
47
|
+
level: a + 1,
|
|
51
48
|
isPenultimate: !1,
|
|
52
|
-
type:
|
|
53
|
-
id:
|
|
54
|
-
limit: (
|
|
55
|
-
children:
|
|
56
|
-
path:
|
|
49
|
+
type: h == null ? void 0 : h.type,
|
|
50
|
+
id: h == null ? void 0 : h.id,
|
|
51
|
+
limit: (h == null ? void 0 : h.limit) ?? "",
|
|
52
|
+
children: i(h == null ? void 0 : h.children, a + 1),
|
|
53
|
+
path: h == null ? void 0 : h.name
|
|
57
54
|
};
|
|
58
|
-
|
|
55
|
+
f.push(x);
|
|
59
56
|
}
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
name:
|
|
63
|
-
label:
|
|
57
|
+
}), f;
|
|
58
|
+
}, l = (s) => s ? [{
|
|
59
|
+
name: s == null ? void 0 : s.name,
|
|
60
|
+
label: s == null ? void 0 : s.name,
|
|
64
61
|
show: !0,
|
|
65
62
|
level: 1,
|
|
66
63
|
isPenultimate: !1,
|
|
67
|
-
type:
|
|
68
|
-
id:
|
|
69
|
-
limit: (
|
|
70
|
-
children:
|
|
71
|
-
path:
|
|
72
|
-
}] : [],
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
(
|
|
76
|
-
|
|
64
|
+
type: s == null ? void 0 : s.type,
|
|
65
|
+
id: s == null ? void 0 : s.id,
|
|
66
|
+
limit: (s == null ? void 0 : s.limit) ?? "",
|
|
67
|
+
children: i(s == null ? void 0 : s.children, 1),
|
|
68
|
+
path: s == null ? void 0 : s.name
|
|
69
|
+
}] : [], u = Ht(() => t != null && t.model ? l(t.model) : []);
|
|
70
|
+
return Bt(
|
|
71
|
+
u,
|
|
72
|
+
(s) => {
|
|
73
|
+
e.value = JSON.parse(JSON.stringify(s));
|
|
77
74
|
},
|
|
78
75
|
{ immediate: !0 }
|
|
79
|
-
), (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, p[1] || (p[1] = [
|
|
86
|
-
P("h3", null, "URDF树", -1)
|
|
87
|
-
])),
|
|
88
|
-
v(_, null, {
|
|
89
|
-
default: Mt(() => [
|
|
90
|
-
ht(v(g, { "max-height": "600px" }, {
|
|
91
|
-
default: Mt(() => [
|
|
92
|
-
P("div", Se, [
|
|
93
|
-
v(De, {
|
|
94
|
-
treeData: i.value,
|
|
95
|
-
expand: !0
|
|
96
|
-
}, null, 8, ["treeData"])
|
|
97
|
-
])
|
|
98
|
-
]),
|
|
99
|
-
_: 1
|
|
100
|
-
}, 512), [
|
|
101
|
-
[Tt, e.value]
|
|
102
|
-
])
|
|
103
|
-
]),
|
|
104
|
-
_: 1
|
|
105
|
-
})
|
|
106
|
-
])) : Jt("", !0);
|
|
107
|
-
};
|
|
76
|
+
), (s, a) => (z(), j("div", Pe, [
|
|
77
|
+
B(ce, {
|
|
78
|
+
treeData: e.value,
|
|
79
|
+
expand: !0
|
|
80
|
+
}, null, 8, ["treeData"])
|
|
81
|
+
]));
|
|
108
82
|
}
|
|
109
|
-
}),
|
|
83
|
+
}), ue = /* @__PURE__ */ Q(Je, [["__scopeId", "data-v-b1177706"]]), Mt = { type: "change" }, dt = { type: "start" }, xt = { type: "end" }, ot = new Vt(), vt = new nt(), pe = Math.cos(70 * Zt.DEG2RAD), S = new y(), H = 2 * Math.PI, M = {
|
|
110
84
|
NONE: -1,
|
|
111
85
|
ROTATE: 0,
|
|
112
86
|
DOLLY: 1,
|
|
@@ -115,8 +89,8 @@ const Ee = { class: "tree-container" }, xe = /* @__PURE__ */ Nt({
|
|
|
115
89
|
TOUCH_PAN: 4,
|
|
116
90
|
TOUCH_DOLLY_PAN: 5,
|
|
117
91
|
TOUCH_DOLLY_ROTATE: 6
|
|
118
|
-
},
|
|
119
|
-
class
|
|
92
|
+
}, ht = 1e-6;
|
|
93
|
+
class me extends Yt {
|
|
120
94
|
/**
|
|
121
95
|
* Constructs a new controls instance.
|
|
122
96
|
*
|
|
@@ -124,7 +98,7 @@ class ze extends le {
|
|
|
124
98
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
125
99
|
*/
|
|
126
100
|
constructor(t, e = null) {
|
|
127
|
-
super(t, e), this.state =
|
|
101
|
+
super(t, e), this.state = M.NONE, this.target = new y(), this.cursor = new y(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: $.ROTATE, MIDDLE: $.DOLLY, RIGHT: $.PAN }, this.touches = { ONE: W.ROTATE, TWO: W.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new y(), this._lastQuaternion = new gt(), this._lastTargetPosition = new y(), this._quat = new gt().setFromUnitVectors(t.up, new y(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new yt(), this._sphericalDelta = new yt(), this._scale = 1, this._panOffset = new y(), this._rotateStart = new U(), this._rotateEnd = new U(), this._rotateDelta = new U(), this._panStart = new U(), this._panEnd = new U(), this._panDelta = new U(), this._dollyStart = new U(), this._dollyEnd = new U(), this._dollyDelta = new U(), this._dollyDirection = new y(), this._mouse = new U(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = fe.bind(this), this._onPointerDown = Ge.bind(this), this._onPointerUp = ge.bind(this), this._onContextMenu = Be.bind(this), this._onMouseWheel = Me.bind(this), this._onKeyDown = ve.bind(this), this._onTouchStart = we.bind(this), this._onTouchMove = Re.bind(this), this._onMouseDown = ye.bind(this), this._onMouseMove = be.bind(this), this._interceptControlDown = Ee.bind(this), this._interceptControlUp = De.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
128
102
|
}
|
|
129
103
|
connect(t) {
|
|
130
104
|
super.connect(t), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -185,45 +159,45 @@ class ze extends le {
|
|
|
185
159
|
* was called, or the initial state.
|
|
186
160
|
*/
|
|
187
161
|
reset() {
|
|
188
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
162
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Mt), this.update(), this.state = M.NONE;
|
|
189
163
|
}
|
|
190
164
|
update(t = null) {
|
|
191
165
|
const e = this.object.position;
|
|
192
|
-
|
|
193
|
-
let i = this.minAzimuthAngle,
|
|
194
|
-
isFinite(i) && isFinite(
|
|
195
|
-
let
|
|
166
|
+
S.copy(e).sub(this.target), S.applyQuaternion(this._quat), this._spherical.setFromVector3(S), this.autoRotate && this.state === M.NONE && this._rotateLeft(this._getAutoRotationAngle(t)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
167
|
+
let i = this.minAzimuthAngle, l = this.maxAzimuthAngle;
|
|
168
|
+
isFinite(i) && isFinite(l) && (i < -Math.PI ? i += H : i > Math.PI && (i -= H), l < -Math.PI ? l += H : l > Math.PI && (l -= H), i <= l ? this._spherical.theta = Math.max(i, Math.min(l, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (i + l) / 2 ? Math.max(i, this._spherical.theta) : Math.min(l, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
169
|
+
let u = !1;
|
|
196
170
|
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
|
|
197
171
|
this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
198
172
|
else {
|
|
199
|
-
const
|
|
200
|
-
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale),
|
|
173
|
+
const s = this._spherical.radius;
|
|
174
|
+
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), u = s != this._spherical.radius;
|
|
201
175
|
}
|
|
202
|
-
if (
|
|
203
|
-
let
|
|
176
|
+
if (S.setFromSpherical(this._spherical), S.applyQuaternion(this._quatInverse), e.copy(this.target).add(S), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
177
|
+
let s = null;
|
|
204
178
|
if (this.object.isPerspectiveCamera) {
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
this.object.position.addScaledVector(this._dollyDirection,
|
|
179
|
+
const a = S.length();
|
|
180
|
+
s = this._clampDistance(a * this._scale);
|
|
181
|
+
const f = a - s;
|
|
182
|
+
this.object.position.addScaledVector(this._dollyDirection, f), this.object.updateMatrixWorld(), u = !!f;
|
|
209
183
|
} else if (this.object.isOrthographicCamera) {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(),
|
|
214
|
-
const
|
|
215
|
-
|
|
184
|
+
const a = new y(this._mouse.x, this._mouse.y, 0);
|
|
185
|
+
a.unproject(this.object);
|
|
186
|
+
const f = this.object.zoom;
|
|
187
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), u = f !== this.object.zoom;
|
|
188
|
+
const h = new y(this._mouse.x, this._mouse.y, 0);
|
|
189
|
+
h.unproject(this.object), this.object.position.sub(h).add(a), this.object.updateMatrixWorld(), s = S.length();
|
|
216
190
|
} else
|
|
217
191
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
218
|
-
|
|
192
|
+
s !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position) : (ot.origin.copy(this.object.position), ot.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ot.direction)) < pe ? this.object.lookAt(this.target) : (vt.setFromNormalAndCoplanarPoint(this.object.up, this.target), ot.intersectPlane(vt, this.target))));
|
|
219
193
|
} else if (this.object.isOrthographicCamera) {
|
|
220
|
-
const
|
|
221
|
-
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)),
|
|
194
|
+
const s = this.object.zoom;
|
|
195
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), s !== this.object.zoom && (this.object.updateProjectionMatrix(), u = !0);
|
|
222
196
|
}
|
|
223
|
-
return this._scale = 1, this._performCursorZoom = !1,
|
|
197
|
+
return this._scale = 1, this._performCursorZoom = !1, u || this._lastPosition.distanceToSquared(this.object.position) > ht || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > ht || this._lastTargetPosition.distanceToSquared(this.target) > ht ? (this.dispatchEvent(Mt), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
224
198
|
}
|
|
225
199
|
_getAutoRotationAngle(t) {
|
|
226
|
-
return t !== null ?
|
|
200
|
+
return t !== null ? H / 60 * this.autoRotateSpeed * t : H / 60 / 60 * this.autoRotateSpeed;
|
|
227
201
|
}
|
|
228
202
|
_getZoomScale(t) {
|
|
229
203
|
const e = Math.abs(t * 0.01);
|
|
@@ -236,19 +210,19 @@ class ze extends le {
|
|
|
236
210
|
this._sphericalDelta.phi -= t;
|
|
237
211
|
}
|
|
238
212
|
_panLeft(t, e) {
|
|
239
|
-
|
|
213
|
+
S.setFromMatrixColumn(e, 0), S.multiplyScalar(-t), this._panOffset.add(S);
|
|
240
214
|
}
|
|
241
215
|
_panUp(t, e) {
|
|
242
|
-
this.screenSpacePanning === !0 ?
|
|
216
|
+
this.screenSpacePanning === !0 ? S.setFromMatrixColumn(e, 1) : (S.setFromMatrixColumn(e, 0), S.crossVectors(this.object.up, S)), S.multiplyScalar(t), this._panOffset.add(S);
|
|
243
217
|
}
|
|
244
218
|
// deltaX and deltaY are in pixels; right and down are positive
|
|
245
219
|
_pan(t, e) {
|
|
246
220
|
const i = this.domElement;
|
|
247
221
|
if (this.object.isPerspectiveCamera) {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
let
|
|
251
|
-
|
|
222
|
+
const l = this.object.position;
|
|
223
|
+
S.copy(l).sub(this.target);
|
|
224
|
+
let u = S.length();
|
|
225
|
+
u *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * t * u / i.clientHeight, this.object.matrix), this._panUp(2 * e * u / i.clientHeight, this.object.matrix);
|
|
252
226
|
} else this.object.isOrthographicCamera ? (this._panLeft(t * (this.object.right - this.object.left) / this.object.zoom / i.clientWidth, this.object.matrix), this._panUp(e * (this.object.top - this.object.bottom) / this.object.zoom / i.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
253
227
|
}
|
|
254
228
|
_dollyOut(t) {
|
|
@@ -261,8 +235,8 @@ class ze extends le {
|
|
|
261
235
|
if (!this.zoomToCursor)
|
|
262
236
|
return;
|
|
263
237
|
this._performCursorZoom = !0;
|
|
264
|
-
const i = this.domElement.getBoundingClientRect(),
|
|
265
|
-
this._mouse.x =
|
|
238
|
+
const i = this.domElement.getBoundingClientRect(), l = t - i.left, u = e - i.top, s = i.width, a = i.height;
|
|
239
|
+
this._mouse.x = l / s * 2 - 1, this._mouse.y = -(u / a) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
|
|
266
240
|
}
|
|
267
241
|
_clampDistance(t) {
|
|
268
242
|
return Math.max(this.minDistance, Math.min(this.maxDistance, t));
|
|
@@ -282,7 +256,7 @@ class ze extends le {
|
|
|
282
256
|
_handleMouseMoveRotate(t) {
|
|
283
257
|
this._rotateEnd.set(t.clientX, t.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
284
258
|
const e = this.domElement;
|
|
285
|
-
this._rotateLeft(
|
|
259
|
+
this._rotateLeft(H * this._rotateDelta.x / e.clientHeight), this._rotateUp(H * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
|
|
286
260
|
}
|
|
287
261
|
_handleMouseMoveDolly(t) {
|
|
288
262
|
this._dollyEnd.set(t.clientX, t.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
|
|
@@ -297,16 +271,16 @@ class ze extends le {
|
|
|
297
271
|
let e = !1;
|
|
298
272
|
switch (t.code) {
|
|
299
273
|
case this.keys.UP:
|
|
300
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(
|
|
274
|
+
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), e = !0;
|
|
301
275
|
break;
|
|
302
276
|
case this.keys.BOTTOM:
|
|
303
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(-
|
|
277
|
+
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateUp(-H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), e = !0;
|
|
304
278
|
break;
|
|
305
279
|
case this.keys.LEFT:
|
|
306
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(
|
|
280
|
+
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), e = !0;
|
|
307
281
|
break;
|
|
308
282
|
case this.keys.RIGHT:
|
|
309
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(-
|
|
283
|
+
t.ctrlKey || t.metaKey || t.shiftKey ? this.enableRotate && this._rotateLeft(-H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), e = !0;
|
|
310
284
|
break;
|
|
311
285
|
}
|
|
312
286
|
e && (t.preventDefault(), this.update());
|
|
@@ -315,21 +289,21 @@ class ze extends le {
|
|
|
315
289
|
if (this._pointers.length === 1)
|
|
316
290
|
this._rotateStart.set(t.pageX, t.pageY);
|
|
317
291
|
else {
|
|
318
|
-
const e = this._getSecondPointerPosition(t), i = 0.5 * (t.pageX + e.x),
|
|
319
|
-
this._rotateStart.set(i,
|
|
292
|
+
const e = this._getSecondPointerPosition(t), i = 0.5 * (t.pageX + e.x), l = 0.5 * (t.pageY + e.y);
|
|
293
|
+
this._rotateStart.set(i, l);
|
|
320
294
|
}
|
|
321
295
|
}
|
|
322
296
|
_handleTouchStartPan(t) {
|
|
323
297
|
if (this._pointers.length === 1)
|
|
324
298
|
this._panStart.set(t.pageX, t.pageY);
|
|
325
299
|
else {
|
|
326
|
-
const e = this._getSecondPointerPosition(t), i = 0.5 * (t.pageX + e.x),
|
|
327
|
-
this._panStart.set(i,
|
|
300
|
+
const e = this._getSecondPointerPosition(t), i = 0.5 * (t.pageX + e.x), l = 0.5 * (t.pageY + e.y);
|
|
301
|
+
this._panStart.set(i, l);
|
|
328
302
|
}
|
|
329
303
|
}
|
|
330
304
|
_handleTouchStartDolly(t) {
|
|
331
|
-
const e = this._getSecondPointerPosition(t), i = t.pageX - e.x,
|
|
332
|
-
this._dollyStart.set(0,
|
|
305
|
+
const e = this._getSecondPointerPosition(t), i = t.pageX - e.x, l = t.pageY - e.y, u = Math.sqrt(i * i + l * l);
|
|
306
|
+
this._dollyStart.set(0, u);
|
|
333
307
|
}
|
|
334
308
|
_handleTouchStartDollyPan(t) {
|
|
335
309
|
this.enableZoom && this._handleTouchStartDolly(t), this.enablePan && this._handleTouchStartPan(t);
|
|
@@ -341,27 +315,27 @@ class ze extends le {
|
|
|
341
315
|
if (this._pointers.length == 1)
|
|
342
316
|
this._rotateEnd.set(t.pageX, t.pageY);
|
|
343
317
|
else {
|
|
344
|
-
const i = this._getSecondPointerPosition(t),
|
|
345
|
-
this._rotateEnd.set(
|
|
318
|
+
const i = this._getSecondPointerPosition(t), l = 0.5 * (t.pageX + i.x), u = 0.5 * (t.pageY + i.y);
|
|
319
|
+
this._rotateEnd.set(l, u);
|
|
346
320
|
}
|
|
347
321
|
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
348
322
|
const e = this.domElement;
|
|
349
|
-
this._rotateLeft(
|
|
323
|
+
this._rotateLeft(H * this._rotateDelta.x / e.clientHeight), this._rotateUp(H * this._rotateDelta.y / e.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
350
324
|
}
|
|
351
325
|
_handleTouchMovePan(t) {
|
|
352
326
|
if (this._pointers.length === 1)
|
|
353
327
|
this._panEnd.set(t.pageX, t.pageY);
|
|
354
328
|
else {
|
|
355
|
-
const e = this._getSecondPointerPosition(t), i = 0.5 * (t.pageX + e.x),
|
|
356
|
-
this._panEnd.set(i,
|
|
329
|
+
const e = this._getSecondPointerPosition(t), i = 0.5 * (t.pageX + e.x), l = 0.5 * (t.pageY + e.y);
|
|
330
|
+
this._panEnd.set(i, l);
|
|
357
331
|
}
|
|
358
332
|
this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
|
|
359
333
|
}
|
|
360
334
|
_handleTouchMoveDolly(t) {
|
|
361
|
-
const e = this._getSecondPointerPosition(t), i = t.pageX - e.x,
|
|
362
|
-
this._dollyEnd.set(0,
|
|
363
|
-
const
|
|
364
|
-
this._updateZoomParameters(
|
|
335
|
+
const e = this._getSecondPointerPosition(t), i = t.pageX - e.x, l = t.pageY - e.y, u = Math.sqrt(i * i + l * l);
|
|
336
|
+
this._dollyEnd.set(0, u), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
|
|
337
|
+
const s = (t.pageX + e.x) * 0.5, a = (t.pageY + e.y) * 0.5;
|
|
338
|
+
this._updateZoomParameters(s, a);
|
|
365
339
|
}
|
|
366
340
|
_handleTouchMoveDollyPan(t) {
|
|
367
341
|
this.enableZoom && this._handleTouchMoveDolly(t), this.enablePan && this._handleTouchMovePan(t);
|
|
@@ -388,7 +362,7 @@ class ze extends le {
|
|
|
388
362
|
}
|
|
389
363
|
_trackPointer(t) {
|
|
390
364
|
let e = this._pointerPositions[t.pointerId];
|
|
391
|
-
e === void 0 && (e = new
|
|
365
|
+
e === void 0 && (e = new U(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
|
|
392
366
|
}
|
|
393
367
|
_getSecondPointerPosition(t) {
|
|
394
368
|
const e = t.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
@@ -412,16 +386,16 @@ class ze extends le {
|
|
|
412
386
|
return t.ctrlKey && !this._controlActive && (i.deltaY *= 10), i;
|
|
413
387
|
}
|
|
414
388
|
}
|
|
415
|
-
function
|
|
416
|
-
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(
|
|
389
|
+
function Ge(o) {
|
|
390
|
+
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(o.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(o) && (this._addPointer(o), o.pointerType === "touch" ? this._onTouchStart(o) : this._onMouseDown(o)));
|
|
417
391
|
}
|
|
418
|
-
function
|
|
419
|
-
this.enabled !== !1 && (
|
|
392
|
+
function fe(o) {
|
|
393
|
+
this.enabled !== !1 && (o.pointerType === "touch" ? this._onTouchMove(o) : this._onMouseMove(o));
|
|
420
394
|
}
|
|
421
|
-
function
|
|
422
|
-
switch (this._removePointer(
|
|
395
|
+
function ge(o) {
|
|
396
|
+
switch (this._removePointer(o), this._pointers.length) {
|
|
423
397
|
case 0:
|
|
424
|
-
this.domElement.releasePointerCapture(
|
|
398
|
+
this.domElement.releasePointerCapture(o.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(xt), this.state = M.NONE;
|
|
425
399
|
break;
|
|
426
400
|
case 1:
|
|
427
401
|
const t = this._pointers[0], e = this._pointerPositions[t];
|
|
@@ -429,9 +403,9 @@ function He(s) {
|
|
|
429
403
|
break;
|
|
430
404
|
}
|
|
431
405
|
}
|
|
432
|
-
function
|
|
406
|
+
function ye(o) {
|
|
433
407
|
let t;
|
|
434
|
-
switch (
|
|
408
|
+
switch (o.button) {
|
|
435
409
|
case 0:
|
|
436
410
|
t = this.mouseButtons.LEFT;
|
|
437
411
|
break;
|
|
@@ -445,136 +419,136 @@ function je(s) {
|
|
|
445
419
|
t = -1;
|
|
446
420
|
}
|
|
447
421
|
switch (t) {
|
|
448
|
-
case
|
|
422
|
+
case $.DOLLY:
|
|
449
423
|
if (this.enableZoom === !1) return;
|
|
450
|
-
this._handleMouseDownDolly(
|
|
424
|
+
this._handleMouseDownDolly(o), this.state = M.DOLLY;
|
|
451
425
|
break;
|
|
452
|
-
case
|
|
453
|
-
if (
|
|
426
|
+
case $.ROTATE:
|
|
427
|
+
if (o.ctrlKey || o.metaKey || o.shiftKey) {
|
|
454
428
|
if (this.enablePan === !1) return;
|
|
455
|
-
this._handleMouseDownPan(
|
|
429
|
+
this._handleMouseDownPan(o), this.state = M.PAN;
|
|
456
430
|
} else {
|
|
457
431
|
if (this.enableRotate === !1) return;
|
|
458
|
-
this._handleMouseDownRotate(
|
|
432
|
+
this._handleMouseDownRotate(o), this.state = M.ROTATE;
|
|
459
433
|
}
|
|
460
434
|
break;
|
|
461
|
-
case
|
|
462
|
-
if (
|
|
435
|
+
case $.PAN:
|
|
436
|
+
if (o.ctrlKey || o.metaKey || o.shiftKey) {
|
|
463
437
|
if (this.enableRotate === !1) return;
|
|
464
|
-
this._handleMouseDownRotate(
|
|
438
|
+
this._handleMouseDownRotate(o), this.state = M.ROTATE;
|
|
465
439
|
} else {
|
|
466
440
|
if (this.enablePan === !1) return;
|
|
467
|
-
this._handleMouseDownPan(
|
|
441
|
+
this._handleMouseDownPan(o), this.state = M.PAN;
|
|
468
442
|
}
|
|
469
443
|
break;
|
|
470
444
|
default:
|
|
471
|
-
this.state =
|
|
445
|
+
this.state = M.NONE;
|
|
472
446
|
}
|
|
473
|
-
this.state !==
|
|
447
|
+
this.state !== M.NONE && this.dispatchEvent(dt);
|
|
474
448
|
}
|
|
475
|
-
function
|
|
449
|
+
function be(o) {
|
|
476
450
|
switch (this.state) {
|
|
477
|
-
case
|
|
451
|
+
case M.ROTATE:
|
|
478
452
|
if (this.enableRotate === !1) return;
|
|
479
|
-
this._handleMouseMoveRotate(
|
|
453
|
+
this._handleMouseMoveRotate(o);
|
|
480
454
|
break;
|
|
481
|
-
case
|
|
455
|
+
case M.DOLLY:
|
|
482
456
|
if (this.enableZoom === !1) return;
|
|
483
|
-
this._handleMouseMoveDolly(
|
|
457
|
+
this._handleMouseMoveDolly(o);
|
|
484
458
|
break;
|
|
485
|
-
case
|
|
459
|
+
case M.PAN:
|
|
486
460
|
if (this.enablePan === !1) return;
|
|
487
|
-
this._handleMouseMovePan(
|
|
461
|
+
this._handleMouseMovePan(o);
|
|
488
462
|
break;
|
|
489
463
|
}
|
|
490
464
|
}
|
|
491
|
-
function
|
|
492
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
465
|
+
function Me(o) {
|
|
466
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== M.NONE || (o.preventDefault(), this.dispatchEvent(dt), this._handleMouseWheel(this._customWheelEvent(o)), this.dispatchEvent(xt));
|
|
493
467
|
}
|
|
494
|
-
function
|
|
495
|
-
this.enabled !== !1 && this._handleKeyDown(
|
|
468
|
+
function ve(o) {
|
|
469
|
+
this.enabled !== !1 && this._handleKeyDown(o);
|
|
496
470
|
}
|
|
497
|
-
function
|
|
498
|
-
switch (this._trackPointer(
|
|
471
|
+
function we(o) {
|
|
472
|
+
switch (this._trackPointer(o), this._pointers.length) {
|
|
499
473
|
case 1:
|
|
500
474
|
switch (this.touches.ONE) {
|
|
501
|
-
case
|
|
475
|
+
case W.ROTATE:
|
|
502
476
|
if (this.enableRotate === !1) return;
|
|
503
|
-
this._handleTouchStartRotate(
|
|
477
|
+
this._handleTouchStartRotate(o), this.state = M.TOUCH_ROTATE;
|
|
504
478
|
break;
|
|
505
|
-
case
|
|
479
|
+
case W.PAN:
|
|
506
480
|
if (this.enablePan === !1) return;
|
|
507
|
-
this._handleTouchStartPan(
|
|
481
|
+
this._handleTouchStartPan(o), this.state = M.TOUCH_PAN;
|
|
508
482
|
break;
|
|
509
483
|
default:
|
|
510
|
-
this.state =
|
|
484
|
+
this.state = M.NONE;
|
|
511
485
|
}
|
|
512
486
|
break;
|
|
513
487
|
case 2:
|
|
514
488
|
switch (this.touches.TWO) {
|
|
515
|
-
case
|
|
489
|
+
case W.DOLLY_PAN:
|
|
516
490
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
517
|
-
this._handleTouchStartDollyPan(
|
|
491
|
+
this._handleTouchStartDollyPan(o), this.state = M.TOUCH_DOLLY_PAN;
|
|
518
492
|
break;
|
|
519
|
-
case
|
|
493
|
+
case W.DOLLY_ROTATE:
|
|
520
494
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
521
|
-
this._handleTouchStartDollyRotate(
|
|
495
|
+
this._handleTouchStartDollyRotate(o), this.state = M.TOUCH_DOLLY_ROTATE;
|
|
522
496
|
break;
|
|
523
497
|
default:
|
|
524
|
-
this.state =
|
|
498
|
+
this.state = M.NONE;
|
|
525
499
|
}
|
|
526
500
|
break;
|
|
527
501
|
default:
|
|
528
|
-
this.state =
|
|
502
|
+
this.state = M.NONE;
|
|
529
503
|
}
|
|
530
|
-
this.state !==
|
|
504
|
+
this.state !== M.NONE && this.dispatchEvent(dt);
|
|
531
505
|
}
|
|
532
|
-
function
|
|
533
|
-
switch (this._trackPointer(
|
|
534
|
-
case
|
|
506
|
+
function Re(o) {
|
|
507
|
+
switch (this._trackPointer(o), this.state) {
|
|
508
|
+
case M.TOUCH_ROTATE:
|
|
535
509
|
if (this.enableRotate === !1) return;
|
|
536
|
-
this._handleTouchMoveRotate(
|
|
510
|
+
this._handleTouchMoveRotate(o), this.update();
|
|
537
511
|
break;
|
|
538
|
-
case
|
|
512
|
+
case M.TOUCH_PAN:
|
|
539
513
|
if (this.enablePan === !1) return;
|
|
540
|
-
this._handleTouchMovePan(
|
|
514
|
+
this._handleTouchMovePan(o), this.update();
|
|
541
515
|
break;
|
|
542
|
-
case
|
|
516
|
+
case M.TOUCH_DOLLY_PAN:
|
|
543
517
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
544
|
-
this._handleTouchMoveDollyPan(
|
|
518
|
+
this._handleTouchMoveDollyPan(o), this.update();
|
|
545
519
|
break;
|
|
546
|
-
case
|
|
520
|
+
case M.TOUCH_DOLLY_ROTATE:
|
|
547
521
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
548
|
-
this._handleTouchMoveDollyRotate(
|
|
522
|
+
this._handleTouchMoveDollyRotate(o), this.update();
|
|
549
523
|
break;
|
|
550
524
|
default:
|
|
551
|
-
this.state =
|
|
525
|
+
this.state = M.NONE;
|
|
552
526
|
}
|
|
553
527
|
}
|
|
554
|
-
function
|
|
555
|
-
this.enabled !== !1 &&
|
|
528
|
+
function Be(o) {
|
|
529
|
+
this.enabled !== !1 && o.preventDefault();
|
|
556
530
|
}
|
|
557
|
-
function
|
|
558
|
-
|
|
531
|
+
function Ee(o) {
|
|
532
|
+
o.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
559
533
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
534
|
+
function De(o) {
|
|
535
|
+
o.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
562
536
|
}
|
|
563
|
-
function
|
|
564
|
-
let t = null, e = null, i = null,
|
|
565
|
-
const
|
|
566
|
-
if (!
|
|
567
|
-
t = new
|
|
568
|
-
const
|
|
569
|
-
e = new
|
|
537
|
+
function xe(o) {
|
|
538
|
+
let t = null, e = null, i = null, l = null, u = null, s = null, a = null, f = null;
|
|
539
|
+
const h = D([]), x = D(new y()), O = D(new y()), k = () => {
|
|
540
|
+
if (!o.value) return;
|
|
541
|
+
t = new $t(), t.background = new Kt(15790320);
|
|
542
|
+
const r = o.value;
|
|
543
|
+
e = new Xt(75, r.clientWidth / r.clientHeight, 0.1, 1e4), e.position.set(8, -8, 6), e.up.set(0, 0, 1), e.lookAt(0, 0, 0), i = new Wt({
|
|
570
544
|
antialias: !0,
|
|
571
545
|
alpha: !0
|
|
572
|
-
}), i.setSize(
|
|
573
|
-
LEFT:
|
|
574
|
-
MIDDLE:
|
|
546
|
+
}), i.setSize(r.clientWidth, r.clientHeight), i.localClippingEnabled = !0, i.shadowMap.enabled = !0, i.shadowMap.type = qt, i.toneMapping = Qt, i.toneMappingExposure = 1, i.outputColorSpace = te, r.appendChild(i.domElement), l = new me(e, i.domElement), l.enableDamping = !0, l.dampingFactor = 0.05, l.mouseButtons = {
|
|
547
|
+
LEFT: $.ROTATE,
|
|
548
|
+
MIDDLE: $.PAN,
|
|
575
549
|
RIGHT: null
|
|
576
|
-
},
|
|
577
|
-
container:
|
|
550
|
+
}, l.panSpeed = 0.7, u = new ee(e, i, {
|
|
551
|
+
container: r,
|
|
578
552
|
type: "cube",
|
|
579
553
|
placement: "top-right",
|
|
580
554
|
offset: {
|
|
@@ -603,49 +577,49 @@ function Ke(s) {
|
|
|
603
577
|
back: {
|
|
604
578
|
label: "Bottom"
|
|
605
579
|
}
|
|
606
|
-
}),
|
|
607
|
-
},
|
|
608
|
-
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const
|
|
580
|
+
}), u.attachControls(l), v(), d();
|
|
581
|
+
}, I = (r, n) => {
|
|
582
|
+
a && (t.remove(a), a.dispose()), f && (t.remove(f), f.geometry.dispose(), f.material.dispose());
|
|
583
|
+
const b = Math.min(Math.max(Math.floor(r / 20), 30), 40);
|
|
584
|
+
a = new ie(r, b, 13421772, 14540253), a.rotateX(Math.PI / 2), a.position.copy(n), t.add(a);
|
|
585
|
+
const R = new at(r, r), L = new oe({
|
|
612
586
|
opacity: 0.3,
|
|
613
587
|
// 阴影透明度
|
|
614
588
|
color: 0
|
|
615
589
|
});
|
|
616
|
-
|
|
617
|
-
},
|
|
618
|
-
if (
|
|
590
|
+
f = new Dt(R, L), f.position.copy(n), f.position.z -= 0.01, f.receiveShadow = !0, t.add(f);
|
|
591
|
+
}, F = () => {
|
|
592
|
+
if (h.value.length === 0)
|
|
619
593
|
return;
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
594
|
+
const r = new st();
|
|
595
|
+
h.value.forEach((V) => {
|
|
596
|
+
r.expandByObject(V);
|
|
623
597
|
});
|
|
624
|
-
const n =
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
598
|
+
const n = r.getSize(new y()), b = r.getCenter(new y()), R = Math.max(n.x, n.y, n.z), L = Math.max(R * 8, 50), N = new y(
|
|
599
|
+
b.x,
|
|
600
|
+
b.y,
|
|
601
|
+
r.min.z
|
|
628
602
|
// 模型的最底部
|
|
629
603
|
);
|
|
630
|
-
|
|
631
|
-
},
|
|
632
|
-
const
|
|
633
|
-
t.add(
|
|
634
|
-
const n = new
|
|
604
|
+
I(L, N);
|
|
605
|
+
}, v = () => {
|
|
606
|
+
const r = new ne(4210752, 0.6);
|
|
607
|
+
t.add(r);
|
|
608
|
+
const n = new rt(16777215, 2);
|
|
635
609
|
n.position.set(10, 10, 8), n.castShadow = !0, n.shadow.mapSize.width = 4096, n.shadow.mapSize.height = 4096, n.shadow.camera.near = 0.5, n.shadow.camera.far = 50, n.shadow.camera.left = -50, n.shadow.camera.right = 50, n.shadow.camera.top = 50, n.shadow.camera.bottom = -50, t.add(n);
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
t.add(
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
},
|
|
647
|
-
|
|
648
|
-
}, m = (
|
|
610
|
+
const b = new rt(16777215, 0.8);
|
|
611
|
+
b.position.set(-8, -8, 6), t.add(b);
|
|
612
|
+
const R = new rt(16777215, 0.6);
|
|
613
|
+
R.position.set(0, -15, 2), t.add(R);
|
|
614
|
+
const L = new ae(16777215, 4473924, 0.8);
|
|
615
|
+
t.add(L);
|
|
616
|
+
const N = new bt(16777215, 1, 50);
|
|
617
|
+
N.position.set(15, 15, 15), t.add(N);
|
|
618
|
+
const V = new bt(16777215, 0.5, 50);
|
|
619
|
+
V.position.set(-15, -15, 15), t.add(V);
|
|
620
|
+
}, d = () => {
|
|
621
|
+
s = requestAnimationFrame(d), l && l.update(), i && t && e && i.render(t, e), u && u.render();
|
|
622
|
+
}, m = (r) => {
|
|
649
623
|
[
|
|
650
624
|
"map",
|
|
651
625
|
"normalMap",
|
|
@@ -658,208 +632,208 @@ function Ke(s) {
|
|
|
658
632
|
"lightMap",
|
|
659
633
|
"aoMap",
|
|
660
634
|
"displacementMap"
|
|
661
|
-
].forEach((
|
|
662
|
-
|
|
663
|
-
}),
|
|
664
|
-
},
|
|
665
|
-
|
|
666
|
-
n.geometry && n.geometry.dispose(), n.material && (Array.isArray(n.material) ? n.material.forEach((
|
|
667
|
-
m(
|
|
635
|
+
].forEach((b) => {
|
|
636
|
+
r[b] && r[b].dispose && r[b].dispose();
|
|
637
|
+
}), r.dispose && r.dispose();
|
|
638
|
+
}, g = (r) => {
|
|
639
|
+
r == null || r.traverse((n) => {
|
|
640
|
+
n.geometry && n.geometry.dispose(), n.material && (Array.isArray(n.material) ? n.material.forEach((b) => {
|
|
641
|
+
m(b);
|
|
668
642
|
}) : m(n.material));
|
|
669
643
|
});
|
|
670
644
|
};
|
|
671
645
|
return {
|
|
672
646
|
// 响应式数据
|
|
673
|
-
currentModels:
|
|
674
|
-
initialCameraPosition:
|
|
675
|
-
initialTargetPosition:
|
|
647
|
+
currentModels: h,
|
|
648
|
+
initialCameraPosition: x,
|
|
649
|
+
initialTargetPosition: O,
|
|
676
650
|
// 方法
|
|
677
|
-
initThreeJS:
|
|
651
|
+
initThreeJS: k,
|
|
678
652
|
handleResize: () => {
|
|
679
|
-
if (!
|
|
680
|
-
const
|
|
681
|
-
e.aspect = n /
|
|
653
|
+
if (!o.value || !e || !i || !u) return;
|
|
654
|
+
const r = o.value, n = r.clientWidth, b = r.clientHeight;
|
|
655
|
+
e.aspect = n / b, e.updateProjectionMatrix(), i.setSize(n, b), u.update();
|
|
682
656
|
},
|
|
683
657
|
fitCameraToAllModels: () => {
|
|
684
|
-
if (!e || !
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
|
|
658
|
+
if (!e || !l || h.value.length === 0) return;
|
|
659
|
+
const r = new st();
|
|
660
|
+
h.value.forEach((V) => {
|
|
661
|
+
r.expandByObject(V);
|
|
688
662
|
});
|
|
689
|
-
const n =
|
|
690
|
-
e.position.copy(
|
|
663
|
+
const n = r.getSize(new y()), b = r.getCenter(new y()), L = Math.max(n.x, n.y, n.z) * 0.8, N = new y(b.x + L, b.y - L, b.z + L);
|
|
664
|
+
e.position.copy(N), e.lookAt(b), l.target.copy(b), l.update(), x.value.copy(N), O.value.copy(b), F();
|
|
691
665
|
},
|
|
692
666
|
getThreeJSObjects: () => ({
|
|
693
667
|
scene: t,
|
|
694
668
|
camera: e,
|
|
695
669
|
renderer: i,
|
|
696
|
-
controls:
|
|
697
|
-
gizmo:
|
|
670
|
+
controls: l,
|
|
671
|
+
gizmo: u
|
|
698
672
|
}),
|
|
699
673
|
clearAllModels: () => {
|
|
700
674
|
if (!t) return;
|
|
701
|
-
|
|
702
|
-
t.remove(n),
|
|
675
|
+
h.value.forEach((n) => {
|
|
676
|
+
t.remove(n), g(n);
|
|
703
677
|
});
|
|
704
|
-
const
|
|
678
|
+
const r = [];
|
|
705
679
|
t.children.forEach((n) => {
|
|
706
|
-
!n.isLight && !n.isCamera && n.type !== "GridHelper" && n !==
|
|
707
|
-
}),
|
|
708
|
-
t.remove(n),
|
|
709
|
-
}),
|
|
680
|
+
!n.isLight && !n.isCamera && n.type !== "GridHelper" && n !== f && r.push(n);
|
|
681
|
+
}), r.forEach((n) => {
|
|
682
|
+
t.remove(n), g(n);
|
|
683
|
+
}), h.value = [], F();
|
|
710
684
|
},
|
|
711
685
|
cleanup: () => {
|
|
712
|
-
|
|
686
|
+
s && cancelAnimationFrame(s), a && a.dispose(), f && (f.geometry.dispose(), f.material.dispose()), i && i.dispose(), l && l.dispose(), u && u.dispose();
|
|
713
687
|
},
|
|
714
|
-
updateGridForModels:
|
|
688
|
+
updateGridForModels: F
|
|
715
689
|
};
|
|
716
690
|
}
|
|
717
|
-
function
|
|
718
|
-
const e =
|
|
719
|
-
let i = null,
|
|
720
|
-
const
|
|
721
|
-
const m = new
|
|
722
|
-
if (
|
|
723
|
-
const
|
|
724
|
-
m.x =
|
|
725
|
-
} else if (
|
|
726
|
-
const
|
|
727
|
-
m.lerpVectors(E,
|
|
728
|
-
} else if (
|
|
729
|
-
const
|
|
730
|
-
m.x =
|
|
691
|
+
function Te(o, t) {
|
|
692
|
+
const e = D(!1);
|
|
693
|
+
let i = null, l = 12700, u = new y(), s = new y(), a = new y(), f = 0, h = null;
|
|
694
|
+
const x = (d) => d < 0.5 ? 4 * d * d * d : 1 - Math.pow(-2 * d + 2, 3) / 2, O = (d) => {
|
|
695
|
+
const m = new y(), g = f * 1.2, E = new y(a.x + g, a.y, a.z), c = new y(a.x, a.y + g, a.z), G = new y(a.x, a.y - g, a.z);
|
|
696
|
+
if (d <= 0.567) {
|
|
697
|
+
const J = d / 0.567 * Math.PI * 2;
|
|
698
|
+
m.x = a.x + Math.cos(J) * g, m.z = a.z + Math.sin(J) * g, m.y = a.y;
|
|
699
|
+
} else if (d <= 0.724) {
|
|
700
|
+
const _ = (d - 0.567) / 0.157, J = x(_);
|
|
701
|
+
m.lerpVectors(E, c, J);
|
|
702
|
+
} else if (d <= 0.881) {
|
|
703
|
+
const _ = (d - 0.724) / 0.157, r = x(_) * Math.PI;
|
|
704
|
+
m.x = a.x + Math.sin(r) * g, m.y = a.y + Math.cos(r) * g, m.z = a.z;
|
|
731
705
|
} else {
|
|
732
|
-
const
|
|
733
|
-
m.lerpVectors(
|
|
706
|
+
const _ = (d - 0.881) / 0.119, J = x(_);
|
|
707
|
+
m.lerpVectors(G, u, J);
|
|
734
708
|
}
|
|
735
709
|
return m;
|
|
736
|
-
},
|
|
737
|
-
const { camera:
|
|
738
|
-
if (!
|
|
710
|
+
}, k = () => {
|
|
711
|
+
const { camera: d, controls: m } = o();
|
|
712
|
+
if (!d || !m) return;
|
|
739
713
|
i || (i = Date.now());
|
|
740
|
-
const
|
|
714
|
+
const g = Date.now() - i, E = Math.min(g / l, 1);
|
|
741
715
|
if (E >= 1) {
|
|
742
|
-
|
|
716
|
+
F();
|
|
743
717
|
return;
|
|
744
718
|
}
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
},
|
|
719
|
+
const c = O(E);
|
|
720
|
+
d.position.copy(c), d.lookAt(a), m.target.copy(a), h = requestAnimationFrame(k);
|
|
721
|
+
}, I = () => {
|
|
748
722
|
if (t.value.length === 0) return;
|
|
749
|
-
const { camera:
|
|
750
|
-
if (!
|
|
751
|
-
|
|
752
|
-
const
|
|
723
|
+
const { camera: d, controls: m } = o();
|
|
724
|
+
if (!d || !m) return;
|
|
725
|
+
u.copy(d.position), s.copy(m.target);
|
|
726
|
+
const g = new st();
|
|
753
727
|
t.value.forEach((n) => {
|
|
754
|
-
|
|
728
|
+
g.expandByObject(n);
|
|
755
729
|
});
|
|
756
|
-
const E =
|
|
757
|
-
|
|
758
|
-
const
|
|
730
|
+
const E = g.getSize(new y());
|
|
731
|
+
a = g.getCenter(new y()), f = Math.max(E.x, E.y, E.z) * 1.2;
|
|
732
|
+
const c = new y(a.x + f * 1.2, a.y, a.z);
|
|
759
733
|
m.enabled = !1;
|
|
760
|
-
const
|
|
761
|
-
const n = Date.now() -
|
|
762
|
-
|
|
734
|
+
const G = d.position.clone(), _ = 1e3, J = Date.now(), r = () => {
|
|
735
|
+
const n = Date.now() - J, b = Math.min(n / _, 1), R = x(b);
|
|
736
|
+
d.position.lerpVectors(G, c, R), d.lookAt(a), m.target.copy(a), b < 1 ? requestAnimationFrame(r) : (e.value = !0, i = null, k());
|
|
763
737
|
};
|
|
764
|
-
|
|
765
|
-
},
|
|
766
|
-
e.value = !1, i = null,
|
|
767
|
-
const { controls:
|
|
768
|
-
|
|
738
|
+
r();
|
|
739
|
+
}, F = () => {
|
|
740
|
+
e.value = !1, i = null, h && (cancelAnimationFrame(h), h = null);
|
|
741
|
+
const { controls: d } = o();
|
|
742
|
+
d && (d.enabled = !0, d.target.copy(s));
|
|
769
743
|
};
|
|
770
744
|
return {
|
|
771
745
|
isAnimating: e,
|
|
772
746
|
toggleAnimation: () => {
|
|
773
747
|
if (e.value) {
|
|
774
|
-
e.value = !1, i = null,
|
|
775
|
-
const { camera:
|
|
776
|
-
if (!
|
|
748
|
+
e.value = !1, i = null, h && (cancelAnimationFrame(h), h = null);
|
|
749
|
+
const { camera: d, controls: m } = o();
|
|
750
|
+
if (!d || !m) return;
|
|
777
751
|
m.enabled = !0;
|
|
778
|
-
const
|
|
779
|
-
const
|
|
780
|
-
|
|
752
|
+
const g = d.position.clone(), E = m.target.clone(), c = 1500, G = Date.now(), _ = () => {
|
|
753
|
+
const J = Date.now() - G, r = Math.min(J / c, 1), n = x(r);
|
|
754
|
+
d.position.lerpVectors(g, u, n), m.target.lerpVectors(E, s, n), r < 1 && requestAnimationFrame(_);
|
|
781
755
|
};
|
|
782
|
-
|
|
756
|
+
_();
|
|
783
757
|
} else
|
|
784
|
-
|
|
758
|
+
I();
|
|
785
759
|
},
|
|
786
|
-
startAnimation:
|
|
787
|
-
stopAnimation:
|
|
760
|
+
startAnimation: I,
|
|
761
|
+
stopAnimation: F
|
|
788
762
|
};
|
|
789
763
|
}
|
|
790
|
-
function
|
|
791
|
-
const e =
|
|
792
|
-
let
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
new
|
|
764
|
+
function Se(o, t) {
|
|
765
|
+
const e = D(!1), i = D("none");
|
|
766
|
+
let l = [], u = [], s = new st(), a = new y();
|
|
767
|
+
const f = () => {
|
|
768
|
+
l = [
|
|
769
|
+
new nt(new y(1, 0, 0), 0),
|
|
796
770
|
// X轴平面
|
|
797
|
-
new
|
|
771
|
+
new nt(new y(0, 1, 0), 0),
|
|
798
772
|
// Y轴平面
|
|
799
|
-
new
|
|
773
|
+
new nt(new y(0, 0, 1), 0)
|
|
800
774
|
// Z轴平面
|
|
801
775
|
];
|
|
802
|
-
},
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}),
|
|
806
|
-
},
|
|
807
|
-
const
|
|
808
|
-
let m,
|
|
809
|
-
|
|
810
|
-
const
|
|
776
|
+
}, h = () => {
|
|
777
|
+
s.makeEmpty(), t.value.forEach((v) => {
|
|
778
|
+
s.expandByObject(v);
|
|
779
|
+
}), a = s.getCenter(new y());
|
|
780
|
+
}, x = (v) => {
|
|
781
|
+
const d = s.getSize(new y());
|
|
782
|
+
let m, g, E;
|
|
783
|
+
v === "x" ? (m = new at(d.z * 1.2, d.y * 1.2), g = new y(a.x, a.y, a.z), E = new lt(0, Math.PI / 2, 0)) : v === "y" ? (m = new at(d.x * 1.2, d.z * 1.2), g = new y(a.x, a.y, a.z), E = new lt(Math.PI / 2, 0, 0)) : v === "z" && (m = new at(d.x * 1.2, d.y * 1.2), g = new y(a.x, a.y, a.z), E = new lt(0, 0, 0));
|
|
784
|
+
const c = new se({
|
|
811
785
|
color: 8900331,
|
|
812
786
|
transparent: !0,
|
|
813
787
|
opacity: 0.3,
|
|
814
|
-
side:
|
|
788
|
+
side: re,
|
|
815
789
|
depthWrite: !1
|
|
816
|
-
}),
|
|
817
|
-
return
|
|
818
|
-
},
|
|
819
|
-
if (
|
|
790
|
+
}), G = new Dt(m, c);
|
|
791
|
+
return G.position.copy(g), G.rotation.copy(E), G;
|
|
792
|
+
}, O = () => {
|
|
793
|
+
if (k(), I(), i.value === "none")
|
|
820
794
|
return;
|
|
821
|
-
|
|
822
|
-
let
|
|
823
|
-
if (i.value === "x" ? (
|
|
795
|
+
h();
|
|
796
|
+
let v = null;
|
|
797
|
+
if (i.value === "x" ? (l[0].constant = -a.x, v = l[0]) : i.value === "y" ? (l[1].constant = -a.y, v = l[1]) : i.value === "z" && (l[2].constant = -a.z, v = l[2]), v) {
|
|
824
798
|
t.value.forEach((m) => {
|
|
825
|
-
m.traverse((
|
|
826
|
-
|
|
827
|
-
E.clippingPlanes = [
|
|
828
|
-
}) :
|
|
799
|
+
m.traverse((g) => {
|
|
800
|
+
g.isMesh && g.material && (Array.isArray(g.material) ? g.material.forEach((E) => {
|
|
801
|
+
E.clippingPlanes = [v];
|
|
802
|
+
}) : g.material.clippingPlanes = [v]);
|
|
829
803
|
});
|
|
830
804
|
});
|
|
831
|
-
const { scene:
|
|
832
|
-
if (
|
|
833
|
-
const m =
|
|
834
|
-
|
|
805
|
+
const { scene: d } = o();
|
|
806
|
+
if (d) {
|
|
807
|
+
const m = x(i.value);
|
|
808
|
+
d.add(m), u.push(m);
|
|
835
809
|
}
|
|
836
810
|
}
|
|
837
|
-
},
|
|
838
|
-
t.value.forEach((
|
|
839
|
-
|
|
840
|
-
|
|
811
|
+
}, k = () => {
|
|
812
|
+
t.value.forEach((v) => {
|
|
813
|
+
v.traverse((d) => {
|
|
814
|
+
d.isMesh && d.material && (Array.isArray(d.material) ? d.material.forEach((m) => {
|
|
841
815
|
m.clippingPlanes = [];
|
|
842
|
-
}) :
|
|
816
|
+
}) : d.material.clippingPlanes = []);
|
|
843
817
|
});
|
|
844
818
|
});
|
|
845
|
-
},
|
|
846
|
-
const { scene:
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}),
|
|
819
|
+
}, I = () => {
|
|
820
|
+
const { scene: v } = o();
|
|
821
|
+
v && u.forEach((d) => {
|
|
822
|
+
v.remove(d), d.geometry.dispose(), d.material.dispose();
|
|
823
|
+
}), u = [];
|
|
850
824
|
};
|
|
851
825
|
return {
|
|
852
826
|
isClipping: e,
|
|
853
827
|
activeClippingAxis: i,
|
|
854
828
|
toggleClipping: () => {
|
|
855
|
-
e.value = !e.value, e.value ? (
|
|
829
|
+
e.value = !e.value, e.value ? (f(), t.value.length > 0 && h()) : (i.value = "none", k(), I());
|
|
856
830
|
},
|
|
857
|
-
updateClippingPlanes:
|
|
858
|
-
clearClippingPlanes:
|
|
859
|
-
clearClippingMeshes:
|
|
831
|
+
updateClippingPlanes: O,
|
|
832
|
+
clearClippingPlanes: k,
|
|
833
|
+
clearClippingMeshes: I
|
|
860
834
|
};
|
|
861
835
|
}
|
|
862
|
-
const
|
|
836
|
+
const Ce = [
|
|
863
837
|
{
|
|
864
838
|
"J1_Joint(GP1)": -3172089e-9,
|
|
865
839
|
"J2_Joint(GP1)": -0.096027484,
|
|
@@ -1484,569 +1458,471 @@ const qe = [
|
|
|
1484
1458
|
"BendGuidePart_Joint(GP2)": -0.015,
|
|
1485
1459
|
"HolderRoate_Joint(GP3)": 6.283185307
|
|
1486
1460
|
}
|
|
1487
|
-
],
|
|
1461
|
+
], Ae = { class: "panel-actions" }, ke = ["disabled"], ze = { class: "panel-content" }, Oe = {
|
|
1488
1462
|
key: 0,
|
|
1489
1463
|
class: "joints-list"
|
|
1490
|
-
},
|
|
1464
|
+
}, Le = { class: "joint-info-row" }, He = { class: "joint-left" }, je = { class: "joint-name" }, Ie = { class: "joint-range" }, Fe = { class: "joint-type" }, Ne = {
|
|
1491
1465
|
key: 0,
|
|
1492
1466
|
class: "joint-control-row"
|
|
1493
|
-
},
|
|
1467
|
+
}, Ue = { class: "slider-container" }, Ye = ["min", "max", "value", "onInput", "disabled"], Ve = { class: "value-display" }, Ze = { class: "joint-value" }, $e = { class: "unit" }, Ke = {
|
|
1494
1468
|
key: 1,
|
|
1495
1469
|
class: "empty-state"
|
|
1496
|
-
},
|
|
1470
|
+
}, Xe = 1e3, We = {
|
|
1497
1471
|
__name: "jointPanel",
|
|
1498
1472
|
props: {
|
|
1499
1473
|
model: Object,
|
|
1500
1474
|
scene: Object
|
|
1501
1475
|
},
|
|
1502
|
-
setup(
|
|
1503
|
-
const t =
|
|
1504
|
-
|
|
1505
|
-
const e =
|
|
1506
|
-
|
|
1507
|
-
const
|
|
1508
|
-
if (!
|
|
1476
|
+
setup(o) {
|
|
1477
|
+
const t = o;
|
|
1478
|
+
D(!0);
|
|
1479
|
+
const e = D([]), i = D(null), l = D(!1), u = D(null), s = Ce;
|
|
1480
|
+
s.length > 0 && Object.keys(s[0]);
|
|
1481
|
+
const a = (c, G = !1) => c === "revolute" ? G ? Math.PI : -Math.PI : c === "prismatic" ? G ? 1 : -1 : 0, f = (c) => {
|
|
1482
|
+
if (!c || !c.joints)
|
|
1509
1483
|
return console.warn("URDF模型没有关节信息"), [];
|
|
1510
|
-
const
|
|
1511
|
-
return Object.keys(
|
|
1512
|
-
const
|
|
1513
|
-
if (
|
|
1484
|
+
const G = [];
|
|
1485
|
+
return Object.keys(c.joints).forEach((_) => {
|
|
1486
|
+
const J = c.joints[_];
|
|
1487
|
+
if (J._jointType === "fixed")
|
|
1514
1488
|
return;
|
|
1515
|
-
const
|
|
1516
|
-
lower:
|
|
1517
|
-
upper:
|
|
1489
|
+
const r = J.limit ? {
|
|
1490
|
+
lower: J.limit.lower ?? a(J._jointType, !1),
|
|
1491
|
+
upper: J.limit.upper ?? a(J._jointType, !0)
|
|
1518
1492
|
} : {
|
|
1519
|
-
lower:
|
|
1520
|
-
upper:
|
|
1493
|
+
lower: a(J._jointType, !1),
|
|
1494
|
+
upper: a(J._jointType, !0)
|
|
1521
1495
|
};
|
|
1522
|
-
|
|
1523
|
-
name:
|
|
1524
|
-
type:
|
|
1525
|
-
limit:
|
|
1526
|
-
currentValue:
|
|
1527
|
-
urdfJoint:
|
|
1496
|
+
G.push({
|
|
1497
|
+
name: _,
|
|
1498
|
+
type: J._jointType || "unknown",
|
|
1499
|
+
limit: r,
|
|
1500
|
+
currentValue: J.angle || 0,
|
|
1501
|
+
urdfJoint: J
|
|
1528
1502
|
});
|
|
1529
|
-
}),
|
|
1530
|
-
},
|
|
1531
|
-
const
|
|
1532
|
-
if (!
|
|
1533
|
-
const
|
|
1534
|
-
if (
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1503
|
+
}), G.sort((_, J) => _.name.localeCompare(J.name));
|
|
1504
|
+
}, h = (c, G) => {
|
|
1505
|
+
const _ = e.value.find((r) => r.name === c);
|
|
1506
|
+
if (!_) return;
|
|
1507
|
+
const J = parseFloat(G);
|
|
1508
|
+
if (_.limit) {
|
|
1509
|
+
const r = Math.max(_.limit.lower, Math.min(_.limit.upper, J));
|
|
1510
|
+
_.currentValue = r;
|
|
1537
1511
|
} else
|
|
1538
|
-
|
|
1539
|
-
t.model && t.model.setJointValue ? t.model.setJointValue(
|
|
1540
|
-
},
|
|
1541
|
-
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1512
|
+
_.currentValue = J;
|
|
1513
|
+
t.model && t.model.setJointValue ? t.model.setJointValue(c, _.currentValue) : _.urdfJoint && _.urdfJoint.setJointValue(_.currentValue);
|
|
1514
|
+
}, x = (c) => {
|
|
1515
|
+
c && Object.keys(c).forEach((G) => {
|
|
1516
|
+
const _ = c[G], J = e.value.find((r) => r.name === G);
|
|
1517
|
+
J && (J.currentValue = _, t.model && t.model.setJointValue ? t.model.setJointValue(G, _) : J.urdfJoint && J.urdfJoint.setJointValue(_));
|
|
1544
1518
|
});
|
|
1545
|
-
},
|
|
1546
|
-
if (!
|
|
1547
|
-
const
|
|
1548
|
-
return Object.keys(
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1551
|
-
}),
|
|
1552
|
-
}, K = () => {
|
|
1553
|
-
r.value ? w() : I();
|
|
1519
|
+
}, O = (c, G, _) => c + (G - c) * _, k = (c, G, _) => {
|
|
1520
|
+
if (!c || !G) return c || G;
|
|
1521
|
+
const J = {};
|
|
1522
|
+
return Object.keys(c).forEach((r) => {
|
|
1523
|
+
const n = c[r], b = G[r];
|
|
1524
|
+
J[r] = O(n, b || n, _);
|
|
1525
|
+
}), J;
|
|
1554
1526
|
}, I = () => {
|
|
1555
|
-
|
|
1527
|
+
l.value ? v() : F();
|
|
1528
|
+
}, F = () => {
|
|
1529
|
+
if (s.length === 0) {
|
|
1556
1530
|
console.warn("没有动画数据");
|
|
1557
1531
|
return;
|
|
1558
1532
|
}
|
|
1559
|
-
|
|
1560
|
-
const
|
|
1561
|
-
let
|
|
1562
|
-
const
|
|
1563
|
-
if (!
|
|
1564
|
-
const
|
|
1565
|
-
if (
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1533
|
+
l.value = !0;
|
|
1534
|
+
const c = s.length, G = 60, _ = Xe / G;
|
|
1535
|
+
let J = 0, r = 0;
|
|
1536
|
+
const n = () => {
|
|
1537
|
+
if (!l.value) return;
|
|
1538
|
+
const b = J / G, R = s[r], L = s[r + 1];
|
|
1539
|
+
if (L) {
|
|
1540
|
+
const N = k(R, L, b);
|
|
1541
|
+
x(N);
|
|
1568
1542
|
} else
|
|
1569
|
-
|
|
1570
|
-
if (
|
|
1571
|
-
|
|
1543
|
+
x(R);
|
|
1544
|
+
if (J++, J >= G && (J = 0, r++, r >= c - 1)) {
|
|
1545
|
+
v();
|
|
1572
1546
|
return;
|
|
1573
1547
|
}
|
|
1574
|
-
|
|
1548
|
+
u.value = setTimeout(n, _);
|
|
1575
1549
|
};
|
|
1576
|
-
|
|
1577
|
-
},
|
|
1578
|
-
|
|
1579
|
-
},
|
|
1580
|
-
e.value.forEach((
|
|
1581
|
-
(
|
|
1550
|
+
n();
|
|
1551
|
+
}, v = () => {
|
|
1552
|
+
l.value = !1, u.value && (clearTimeout(u.value), u.value = null);
|
|
1553
|
+
}, d = () => {
|
|
1554
|
+
e.value.forEach((c) => {
|
|
1555
|
+
(c.type === "revolute" || c.type === "prismatic") && h(c.name, 0);
|
|
1582
1556
|
});
|
|
1583
1557
|
};
|
|
1584
|
-
|
|
1558
|
+
Bt(
|
|
1585
1559
|
() => t.model,
|
|
1586
|
-
(
|
|
1587
|
-
|
|
1560
|
+
(c) => {
|
|
1561
|
+
c ? e.value = f(c) : e.value = [];
|
|
1588
1562
|
},
|
|
1589
1563
|
{ immediate: !0 }
|
|
1590
1564
|
);
|
|
1591
1565
|
const m = () => {
|
|
1592
|
-
!t.model ||
|
|
1593
|
-
|
|
1566
|
+
!t.model || l.value || e.value.forEach((c) => {
|
|
1567
|
+
c.urdfJoint && c.urdfJoint.angle !== void 0 && (c.currentValue = c.urdfJoint.angle);
|
|
1594
1568
|
});
|
|
1595
|
-
},
|
|
1596
|
-
const
|
|
1597
|
-
m(), i.value = requestAnimationFrame(
|
|
1569
|
+
}, g = () => {
|
|
1570
|
+
const c = () => {
|
|
1571
|
+
m(), i.value = requestAnimationFrame(c);
|
|
1598
1572
|
};
|
|
1599
|
-
|
|
1573
|
+
c();
|
|
1600
1574
|
}, E = () => {
|
|
1601
1575
|
i.value && (cancelAnimationFrame(i.value), i.value = null);
|
|
1602
1576
|
};
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
}),
|
|
1606
|
-
E(),
|
|
1607
|
-
})
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
position: new u(1.128, -0.699, 0.378),
|
|
1612
|
-
tubeSegments: 12
|
|
1613
|
-
}, ...l }, D = [...h].reverse().map((z, A, L) => A === L.length - 1 ? { ...z, c: 0, r: 0 } : {
|
|
1614
|
-
...z,
|
|
1615
|
-
c: L[A + 1].c,
|
|
1616
|
-
r: L[A + 1].r
|
|
1617
|
-
});
|
|
1618
|
-
if (!t.scene) return;
|
|
1619
|
-
const k = (z, A) => Math.abs(z) * Math.PI * A / 180, T = [];
|
|
1620
|
-
for (let z = 0; z < D.length; z++) {
|
|
1621
|
-
const { y: A, b: L, c: W, r: X } = D[z];
|
|
1622
|
-
if (T.push({
|
|
1623
|
-
type: "straight",
|
|
1624
|
-
length: A,
|
|
1625
|
-
segmentIndex: z,
|
|
1626
|
-
twist: L
|
|
1627
|
-
}), W !== 0 && X !== 0) {
|
|
1628
|
-
const nt = k(W, X);
|
|
1629
|
-
T.push({
|
|
1630
|
-
type: "bend",
|
|
1631
|
-
length: nt,
|
|
1632
|
-
angle: W,
|
|
1633
|
-
radius: X,
|
|
1634
|
-
segmentIndex: z
|
|
1635
|
-
});
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
const d = (z = []) => {
|
|
1639
|
-
const A = [];
|
|
1640
|
-
let L = new u(0, 0, 0), W = new u(1, 0, 0), X = new u(0, 1, 0), nt = new u(0, 0, 1);
|
|
1641
|
-
A.push(L.clone());
|
|
1642
|
-
for (let Z = 0; Z < T.length; Z++) {
|
|
1643
|
-
const F = T[Z];
|
|
1644
|
-
if (F.type === "straight") {
|
|
1645
|
-
if (F.twist !== 0) {
|
|
1646
|
-
const ot = F.twist * Math.PI / 180, Q = new xt().makeRotationAxis(X, ot);
|
|
1647
|
-
W.applyMatrix4(Q), nt.applyMatrix4(Q);
|
|
1648
|
-
}
|
|
1649
|
-
const st = F.length / 1e3, rt = Math.max(8, Math.floor(F.length * 0.05));
|
|
1650
|
-
for (let ot = 1; ot <= rt; ot++) {
|
|
1651
|
-
const Q = ot / rt, lt = L.clone().add(X.clone().multiplyScalar(st * Q));
|
|
1652
|
-
A.push(lt);
|
|
1653
|
-
}
|
|
1654
|
-
L.add(X.clone().multiplyScalar(st));
|
|
1655
|
-
} else if (F.type === "bend") {
|
|
1656
|
-
const st = z[F.segmentIndex] || 0, rt = F.angle * Math.PI / 180, ot = F.radius / 1e3;
|
|
1657
|
-
if (st > 0) {
|
|
1658
|
-
const Q = L.clone().add(W.clone().multiplyScalar(-ot)), lt = Math.max(16, Math.floor(Math.abs(F.angle) / 5));
|
|
1659
|
-
for (let vt = 1; vt <= lt; vt++) {
|
|
1660
|
-
const Xt = vt / lt, Wt = rt * st * Xt, qt = new xt().makeRotationAxis(nt, Wt), zt = W.clone().multiplyScalar(ot);
|
|
1661
|
-
zt.applyMatrix4(qt);
|
|
1662
|
-
const Qt = Q.clone().add(zt);
|
|
1663
|
-
A.push(Qt);
|
|
1664
|
-
}
|
|
1665
|
-
const _t = rt * st, Pt = new xt().makeRotationAxis(nt, _t), pt = W.clone().multiplyScalar(ot);
|
|
1666
|
-
pt.applyMatrix4(Pt), L = Q.clone().add(pt), W.applyMatrix4(Pt), X.applyMatrix4(Pt);
|
|
1667
|
-
} else {
|
|
1668
|
-
const Q = F.length / 1e3, lt = Math.max(8, Math.floor(F.length * 0.05));
|
|
1669
|
-
for (let _t = 1; _t <= lt; _t++) {
|
|
1670
|
-
const Pt = _t / lt, pt = L.clone().add(X.clone().multiplyScalar(Q * Pt));
|
|
1671
|
-
A.push(pt);
|
|
1672
|
-
}
|
|
1673
|
-
L.add(X.clone().multiplyScalar(Q));
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
const Rt = new we(A);
|
|
1678
|
-
return new Re(Rt, A.length * 2, n / 1e3, M.tubeSegments, !1);
|
|
1679
|
-
}, et = new Vt({
|
|
1680
|
-
color: 11119017,
|
|
1681
|
-
shininess: 60
|
|
1682
|
-
}), B = D.map(() => 0), $t = d(B), at = new St($t, et);
|
|
1683
|
-
at.position.copy(M.position), t.scene.add(at);
|
|
1684
|
-
const Ct = D.map((z, A) => z.c !== 0 && z.r !== 0 ? A : -1).filter((z) => z !== -1), dt = [...Ct].reverse(), Kt = Date.now(), kt = () => {
|
|
1685
|
-
const A = (Date.now() - Kt) / 1e3, L = Math.min(Math.floor(A / M.segmentDuration), dt.length), W = A % M.segmentDuration, X = Math.min(W / M.segmentDuration, 1), nt = [...Array(D.length)].map(() => 0);
|
|
1686
|
-
for (let Z = 0; Z < L; Z++)
|
|
1687
|
-
nt[dt[Z]] = 1;
|
|
1688
|
-
L < dt.length && (nt[dt[L]] = X);
|
|
1689
|
-
try {
|
|
1690
|
-
const Z = d(nt);
|
|
1691
|
-
at.geometry.dispose(), at.geometry = Z;
|
|
1692
|
-
} catch (Z) {
|
|
1693
|
-
console.error("更新几何体失败:", Z);
|
|
1694
|
-
}
|
|
1695
|
-
const Rt = dt.length * M.segmentDuration;
|
|
1696
|
-
if (A < Rt)
|
|
1697
|
-
requestAnimationFrame(kt);
|
|
1698
|
-
else {
|
|
1699
|
-
const Z = [...Array(D.length)].map(
|
|
1700
|
-
(st, rt) => Ct.includes(rt) ? 1 : 0
|
|
1701
|
-
), F = d(Z);
|
|
1702
|
-
at.geometry.dispose(), at.geometry = F;
|
|
1703
|
-
}
|
|
1704
|
-
};
|
|
1705
|
-
return kt(), at;
|
|
1706
|
-
}, H = () => {
|
|
1707
|
-
if (!t.scene) return;
|
|
1708
|
-
const h = [];
|
|
1709
|
-
t.scene.traverse((a) => {
|
|
1710
|
-
a.isMesh && a.geometry && a.geometry.type === "TubeGeometry" && h.push(a);
|
|
1711
|
-
}), h.forEach((a) => {
|
|
1712
|
-
a.geometry.dispose(), a.material && a.material.dispose(), t.scene.remove(a);
|
|
1713
|
-
});
|
|
1714
|
-
}, x = () => {
|
|
1715
|
-
H(), R(
|
|
1716
|
-
[
|
|
1717
|
-
{ y: 88.61, b: 0, c: 90, r: 8 },
|
|
1718
|
-
{ y: 54.29, b: -90, c: 90, r: 8 },
|
|
1719
|
-
{ y: 460.1, b: 180, c: 90, r: 8 },
|
|
1720
|
-
{ y: 48.95, b: -90, c: 90, r: 8 },
|
|
1721
|
-
{ y: 27, b: 0, c: 0, r: 0 }
|
|
1722
|
-
],
|
|
1723
|
-
// YBCR数据
|
|
1724
|
-
729,
|
|
1725
|
-
// 管道总长度(mm)
|
|
1726
|
-
3.17,
|
|
1727
|
-
// 管道半径(mm)
|
|
1728
|
-
{
|
|
1729
|
-
segmentDuration: 3,
|
|
1730
|
-
position: new u(1.128, -0.699, 0.378)
|
|
1731
|
-
}
|
|
1732
|
-
);
|
|
1733
|
-
};
|
|
1734
|
-
return (h, a) => (U(), $(Ot, null, [
|
|
1735
|
-
P("div", Qe, [
|
|
1736
|
-
P("button", {
|
|
1737
|
-
onClick: K,
|
|
1577
|
+
return Et(() => {
|
|
1578
|
+
g();
|
|
1579
|
+
}), jt(() => {
|
|
1580
|
+
E(), v();
|
|
1581
|
+
}), (c, G) => (z(), j(ut, null, [
|
|
1582
|
+
p("div", Ae, [
|
|
1583
|
+
p("button", {
|
|
1584
|
+
onClick: I,
|
|
1738
1585
|
class: "animate-btn"
|
|
1739
|
-
},
|
|
1740
|
-
|
|
1741
|
-
onClick:
|
|
1742
|
-
disabled:
|
|
1743
|
-
}, "重置所有关节", 8,
|
|
1744
|
-
P("button", { onClick: x }, "弯管"),
|
|
1745
|
-
P("button", { onClick: H }, "清理管子")
|
|
1586
|
+
}, Y(l.value ? "停止动画" : "开始动画"), 1),
|
|
1587
|
+
p("button", {
|
|
1588
|
+
onClick: d,
|
|
1589
|
+
disabled: l.value
|
|
1590
|
+
}, "重置所有关节", 8, ke)
|
|
1746
1591
|
]),
|
|
1747
|
-
|
|
1748
|
-
e.value.length > 0 ? (
|
|
1749
|
-
(
|
|
1750
|
-
var
|
|
1751
|
-
return
|
|
1752
|
-
key:
|
|
1592
|
+
p("div", ze, [
|
|
1593
|
+
e.value.length > 0 ? (z(), j("div", Oe, [
|
|
1594
|
+
(z(!0), j(ut, null, It(e.value, (_) => {
|
|
1595
|
+
var J, r, n, b;
|
|
1596
|
+
return z(), j("div", {
|
|
1597
|
+
key: _.name,
|
|
1753
1598
|
class: "joint-item"
|
|
1754
1599
|
}, [
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1600
|
+
p("div", Le, [
|
|
1601
|
+
p("div", He, [
|
|
1602
|
+
p("span", je, Y(_.name), 1),
|
|
1603
|
+
p("span", Ie, " [" + Y(((J = _.limit) == null ? void 0 : J.lower.toFixed(2)) ?? (_.type === "revolute" ? "-3.14" : "-1.00")) + ", " + Y(((r = _.limit) == null ? void 0 : r.upper.toFixed(2)) ?? (_.type === "revolute" ? "3.14" : "1.00")) + "] ", 1)
|
|
1759
1604
|
]),
|
|
1760
|
-
|
|
1605
|
+
p("span", Fe, Y(_.type), 1)
|
|
1761
1606
|
]),
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1607
|
+
_.type === "revolute" || _.type === "prismatic" ? (z(), j("div", Ne, [
|
|
1608
|
+
p("div", Ue, [
|
|
1609
|
+
p("input", {
|
|
1765
1610
|
type: "range",
|
|
1766
|
-
min: ((
|
|
1767
|
-
max: ((
|
|
1611
|
+
min: ((n = _.limit) == null ? void 0 : n.lower) ?? (_.type === "revolute" ? -Math.PI : -1),
|
|
1612
|
+
max: ((b = _.limit) == null ? void 0 : b.upper) ?? (_.type === "revolute" ? Math.PI : 1),
|
|
1768
1613
|
step: 0.01,
|
|
1769
|
-
value:
|
|
1770
|
-
onInput: (
|
|
1614
|
+
value: _.currentValue,
|
|
1615
|
+
onInput: (R) => h(_.name, R.target.value),
|
|
1771
1616
|
class: "joint-slider",
|
|
1772
|
-
disabled:
|
|
1773
|
-
}, null, 40,
|
|
1617
|
+
disabled: l.value
|
|
1618
|
+
}, null, 40, Ye)
|
|
1774
1619
|
]),
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1620
|
+
p("div", Ve, [
|
|
1621
|
+
p("span", Ze, Y(_.currentValue.toFixed(3)), 1),
|
|
1622
|
+
p("span", $e, Y(_.type === "revolute" ? "rad" : "m"), 1)
|
|
1778
1623
|
])
|
|
1779
|
-
])) :
|
|
1624
|
+
])) : q("", !0)
|
|
1780
1625
|
]);
|
|
1781
1626
|
}), 128))
|
|
1782
|
-
])) : (
|
|
1783
|
-
|
|
1627
|
+
])) : (z(), j("div", Ke, G[0] || (G[0] = [
|
|
1628
|
+
p("p", null, "未检测到可控制的关节", -1)
|
|
1784
1629
|
])))
|
|
1785
1630
|
])
|
|
1786
1631
|
], 64));
|
|
1787
1632
|
}
|
|
1788
|
-
},
|
|
1789
|
-
function
|
|
1790
|
-
return
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1633
|
+
}, qe = /* @__PURE__ */ Q(We, [["__scopeId", "data-v-ef47ba0d"]]), Qe = ["xlink:href"];
|
|
1634
|
+
function ti(o, t, e, i, l, u) {
|
|
1635
|
+
return z(), j("div", {
|
|
1636
|
+
class: pt(["container", { active: o.active }])
|
|
1637
|
+
}, [
|
|
1638
|
+
(z(), j("svg", {
|
|
1639
|
+
class: pt(["svg-icon", [o.$attrs.class, o.spin && "svg-icon-spin"]]),
|
|
1640
|
+
style: Ft(o.getStyle),
|
|
1794
1641
|
"aria-hidden": "true"
|
|
1795
1642
|
}, [
|
|
1796
|
-
|
|
1643
|
+
p("use", { "xlink:href": o.symbolId }, null, 8, Qe)
|
|
1797
1644
|
], 6))
|
|
1798
|
-
]);
|
|
1645
|
+
], 2);
|
|
1799
1646
|
}
|
|
1800
|
-
const
|
|
1647
|
+
const C = /* @__PURE__ */ Q(le, [["render", ti], ["__scopeId", "data-v-1f76fc63"]]), ei = { class: "obj-viewer-container" }, ii = { class: "buttonGroup-top" }, oi = { class: "buttonGroup-topLeft" }, ni = { class: "buttonGroup-left" }, ai = { class: "buttonGroup-right" }, si = { class: "left-panel" }, ri = { class: "panel-header" }, li = {
|
|
1801
1648
|
key: 1,
|
|
1802
1649
|
class: "panel-content"
|
|
1803
|
-
},
|
|
1650
|
+
}, hi = { class: "radio-group" }, di = { class: "radio-label" }, _i = { class: "radio-label" }, ci = { class: "radio-label" }, Pi = { class: "radio-label" }, Ji = { class: "right-panel" }, ui = { class: "panel-header" }, pi = {
|
|
1804
1651
|
key: 0,
|
|
1805
1652
|
class: "loading-overlay"
|
|
1806
|
-
},
|
|
1653
|
+
}, mi = {
|
|
1807
1654
|
__name: "threeModel",
|
|
1808
|
-
setup(
|
|
1655
|
+
setup(o, { expose: t }) {
|
|
1809
1656
|
let e = null, i = !1;
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1812
|
-
const
|
|
1813
|
-
currentModels:
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1657
|
+
const l = D(null), u = D(!1), s = D("");
|
|
1658
|
+
D(!1);
|
|
1659
|
+
const a = D(!1), f = D(!1), h = D(""), x = D(!1), O = D(""), {
|
|
1660
|
+
currentModels: k,
|
|
1661
|
+
initialCameraPosition: I,
|
|
1662
|
+
initialTargetPosition: F,
|
|
1663
|
+
initThreeJS: v,
|
|
1664
|
+
handleResize: d,
|
|
1665
|
+
fitCameraToAllModels: m,
|
|
1666
|
+
getThreeJSObjects: g,
|
|
1667
|
+
clearAllModels: E,
|
|
1819
1668
|
cleanup: c
|
|
1820
|
-
} =
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
), { addModelsFromUrls:
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
),
|
|
1830
|
-
|
|
1831
|
-
|
|
1669
|
+
} = xe(l), { isAnimating: G, toggleAnimation: _, stopAnimation: J } = Te(g, k), { isClipping: r, activeClippingAxis: n, toggleClipping: b, updateClippingPlanes: R } = Se(
|
|
1670
|
+
g,
|
|
1671
|
+
k
|
|
1672
|
+
), { addModelsFromUrls: L, loadModelByDefaultPath: N, urdfModel: V } = he(
|
|
1673
|
+
g,
|
|
1674
|
+
k,
|
|
1675
|
+
u,
|
|
1676
|
+
s,
|
|
1677
|
+
E
|
|
1678
|
+
), Tt = () => {
|
|
1679
|
+
if (a.value || k.value.length === 0) return;
|
|
1680
|
+
a.value = !0, G.value && J();
|
|
1681
|
+
const { camera: T, controls: P } = g();
|
|
1682
|
+
if (!T || !P) return;
|
|
1683
|
+
P.enabled = !0;
|
|
1684
|
+
const Z = (K) => K < 0.5 ? 4 * K * K * K : 1 - Math.pow(-2 * K + 2, 3) / 2, w = T.position.clone(), zt = P.target.clone(), Ot = 1500, Lt = Date.now(), ct = () => {
|
|
1685
|
+
const K = Date.now() - Lt, Pt = Math.min(K / Ot, 1), Jt = Z(Pt);
|
|
1686
|
+
T.position.lerpVectors(w, I.value, Jt), P.target.lerpVectors(zt, F.value, Jt), Pt < 1 ? requestAnimationFrame(ct) : a.value = !1;
|
|
1687
|
+
};
|
|
1688
|
+
ct();
|
|
1689
|
+
}, St = async () => i ? Promise.resolve() : new Promise((T) => {
|
|
1690
|
+
const P = () => {
|
|
1691
|
+
i ? T() : requestAnimationFrame(P);
|
|
1832
1692
|
};
|
|
1833
|
-
|
|
1834
|
-
}),
|
|
1693
|
+
P();
|
|
1694
|
+
}), _t = async (T, P) => {
|
|
1835
1695
|
try {
|
|
1836
|
-
await
|
|
1837
|
-
const
|
|
1838
|
-
return
|
|
1839
|
-
} catch (
|
|
1840
|
-
throw console.error("加载模型失败:",
|
|
1696
|
+
await St(), G.value && J(), r.value && b();
|
|
1697
|
+
const Z = await P(T);
|
|
1698
|
+
return m(), Z;
|
|
1699
|
+
} catch (Z) {
|
|
1700
|
+
throw console.error("加载模型失败:", Z), Z;
|
|
1841
1701
|
}
|
|
1842
|
-
},
|
|
1843
|
-
|
|
1702
|
+
}, Ct = async (T) => _t(T, L), At = async (T) => _t(T, N), tt = (T) => {
|
|
1703
|
+
f.value = !0, h.value = T, T === "剖面图" && !r.value && b();
|
|
1704
|
+
}, kt = (T) => {
|
|
1705
|
+
x.value = !0, O.value = T;
|
|
1844
1706
|
};
|
|
1845
|
-
return
|
|
1846
|
-
await
|
|
1707
|
+
return Et(async () => {
|
|
1708
|
+
await Nt();
|
|
1847
1709
|
try {
|
|
1848
|
-
|
|
1710
|
+
v(), e = g().scene, i = !0, window.addEventListener("resize", d);
|
|
1849
1711
|
} catch (T) {
|
|
1850
1712
|
console.error("Three.js初始化失败:", T);
|
|
1851
1713
|
}
|
|
1852
|
-
}),
|
|
1853
|
-
i = !1, window.removeEventListener("resize",
|
|
1714
|
+
}), Ut(() => {
|
|
1715
|
+
i = !1, h.value = "", O.value = "", window.removeEventListener("resize", d), G.value && J(), c();
|
|
1854
1716
|
}), t({
|
|
1855
|
-
addModelsFromUrls:
|
|
1856
|
-
loadModelByDefaultPath:
|
|
1857
|
-
}), (T,
|
|
1858
|
-
const
|
|
1859
|
-
return
|
|
1860
|
-
|
|
1717
|
+
addModelsFromUrls: Ct,
|
|
1718
|
+
loadModelByDefaultPath: At
|
|
1719
|
+
}), (T, P) => {
|
|
1720
|
+
const Z = Rt("el-scrollbar");
|
|
1721
|
+
return z(), j("div", ei, [
|
|
1722
|
+
p("div", {
|
|
1861
1723
|
ref_key: "threejsContainer",
|
|
1862
|
-
ref:
|
|
1724
|
+
ref: l,
|
|
1863
1725
|
class: "threejs-container"
|
|
1864
1726
|
}, null, 512),
|
|
1865
|
-
|
|
1866
|
-
|
|
1727
|
+
p("div", ii, [
|
|
1728
|
+
B(C, {
|
|
1867
1729
|
name: "guanjianjiexi",
|
|
1868
1730
|
size: "34"
|
|
1869
1731
|
}),
|
|
1870
|
-
|
|
1732
|
+
B(C, {
|
|
1871
1733
|
name: "guanjiekongzhi",
|
|
1872
1734
|
size: "34"
|
|
1873
1735
|
}),
|
|
1874
|
-
|
|
1736
|
+
B(C, {
|
|
1875
1737
|
name: "gongyishengcheng",
|
|
1876
1738
|
size: "34"
|
|
1877
1739
|
}),
|
|
1878
|
-
|
|
1740
|
+
B(C, {
|
|
1879
1741
|
name: "buchangshezhi",
|
|
1880
1742
|
size: "34"
|
|
1881
1743
|
}),
|
|
1882
|
-
|
|
1744
|
+
B(C, {
|
|
1883
1745
|
name: "shuchujiagongchengxu",
|
|
1884
1746
|
size: "34"
|
|
1885
1747
|
})
|
|
1886
1748
|
]),
|
|
1887
|
-
|
|
1888
|
-
|
|
1749
|
+
p("div", oi, [
|
|
1750
|
+
B(C, {
|
|
1751
|
+
name: "donghuafangzhen",
|
|
1752
|
+
size: "24",
|
|
1753
|
+
onClick: Tt,
|
|
1754
|
+
title: "重置"
|
|
1755
|
+
}),
|
|
1756
|
+
B(C, {
|
|
1889
1757
|
name: "fangda",
|
|
1890
|
-
size: "24"
|
|
1758
|
+
size: "24",
|
|
1759
|
+
title: "放大"
|
|
1891
1760
|
}),
|
|
1892
|
-
|
|
1761
|
+
B(C, {
|
|
1893
1762
|
name: "suoxiao",
|
|
1894
|
-
size: "24"
|
|
1763
|
+
size: "24",
|
|
1764
|
+
title: "缩小"
|
|
1895
1765
|
}),
|
|
1896
|
-
|
|
1897
|
-
name: "
|
|
1898
|
-
size: "24"
|
|
1899
|
-
|
|
1766
|
+
B(C, {
|
|
1767
|
+
name: "donghuafangzhen",
|
|
1768
|
+
size: "24",
|
|
1769
|
+
onClick: A(_),
|
|
1770
|
+
title: A(G) ? "停止动画" : "动画视图"
|
|
1771
|
+
}, null, 8, ["onClick", "title"])
|
|
1900
1772
|
]),
|
|
1901
|
-
|
|
1902
|
-
|
|
1773
|
+
p("div", ni, [
|
|
1774
|
+
B(C, {
|
|
1903
1775
|
name: "jiegoushu",
|
|
1904
1776
|
size: "24",
|
|
1905
|
-
onClick:
|
|
1906
|
-
|
|
1907
|
-
|
|
1777
|
+
onClick: P[0] || (P[0] = (w) => tt("场景树")),
|
|
1778
|
+
active: f.value && h.value === "场景树"
|
|
1779
|
+
}, null, 8, ["active"]),
|
|
1780
|
+
B(C, {
|
|
1908
1781
|
name: "donghuafangzhen",
|
|
1909
1782
|
size: "24",
|
|
1910
|
-
onClick:
|
|
1911
|
-
|
|
1912
|
-
|
|
1783
|
+
onClick: P[1] || (P[1] = (w) => tt("剖面图")),
|
|
1784
|
+
active: f.value && h.value === "剖面图"
|
|
1785
|
+
}, null, 8, ["active"]),
|
|
1786
|
+
B(C, {
|
|
1913
1787
|
name: "donghuafangzhen",
|
|
1914
1788
|
size: "24",
|
|
1915
|
-
onClick:
|
|
1789
|
+
onClick: P[2] || (P[2] = (w) => tt("场景树3"))
|
|
1916
1790
|
}),
|
|
1917
|
-
|
|
1791
|
+
B(C, {
|
|
1918
1792
|
name: "donghuafangzhen",
|
|
1919
1793
|
size: "24",
|
|
1920
|
-
onClick:
|
|
1794
|
+
onClick: P[3] || (P[3] = (w) => tt("场景4"))
|
|
1921
1795
|
})
|
|
1922
1796
|
]),
|
|
1923
|
-
|
|
1924
|
-
|
|
1797
|
+
p("div", ai, [
|
|
1798
|
+
B(C, {
|
|
1925
1799
|
name: "donghuafangzhen",
|
|
1926
1800
|
size: "24"
|
|
1927
1801
|
}),
|
|
1928
|
-
|
|
1802
|
+
B(C, {
|
|
1929
1803
|
name: "donghuafangzhen",
|
|
1930
1804
|
size: "24"
|
|
1931
1805
|
}),
|
|
1932
|
-
|
|
1806
|
+
B(C, {
|
|
1933
1807
|
name: "guanjiekongzhi",
|
|
1934
1808
|
size: "24",
|
|
1935
|
-
onClick:
|
|
1936
|
-
|
|
1937
|
-
|
|
1809
|
+
onClick: P[4] || (P[4] = (w) => kt("关节控制")),
|
|
1810
|
+
active: x.value && O.value === "关节控制"
|
|
1811
|
+
}, null, 8, ["active"]),
|
|
1812
|
+
B(C, {
|
|
1938
1813
|
name: "donghuafangzhen",
|
|
1939
1814
|
size: "24"
|
|
1940
1815
|
}),
|
|
1941
|
-
|
|
1816
|
+
B(C, {
|
|
1942
1817
|
name: "donghuafangzhen",
|
|
1943
1818
|
size: "24"
|
|
1944
1819
|
}),
|
|
1945
|
-
|
|
1820
|
+
B(C, {
|
|
1946
1821
|
name: "donghuafangzhen",
|
|
1947
1822
|
size: "24"
|
|
1948
1823
|
})
|
|
1949
1824
|
]),
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1825
|
+
X(p("div", si, [
|
|
1826
|
+
p("div", ri, [
|
|
1827
|
+
p("span", null, Y(h.value), 1),
|
|
1828
|
+
p("span", {
|
|
1954
1829
|
class: "close",
|
|
1955
|
-
onClick:
|
|
1830
|
+
onClick: P[5] || (P[5] = (w) => f.value = !1)
|
|
1956
1831
|
}, " X ")
|
|
1957
1832
|
]),
|
|
1958
|
-
|
|
1959
|
-
default:
|
|
1960
|
-
|
|
1833
|
+
B(Z, { "max-height": "650px" }, {
|
|
1834
|
+
default: mt(() => [
|
|
1835
|
+
h.value === "场景树" ? (z(), Gt(ue, {
|
|
1961
1836
|
key: 0,
|
|
1962
|
-
model:
|
|
1963
|
-
}, null, 8, ["model"])) :
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1837
|
+
model: A(V)
|
|
1838
|
+
}, null, 8, ["model"])) : q("", !0),
|
|
1839
|
+
h.value === "剖面图" ? (z(), j("div", li, [
|
|
1840
|
+
p("div", hi, [
|
|
1841
|
+
p("label", di, [
|
|
1842
|
+
X(p("input", {
|
|
1968
1843
|
type: "radio",
|
|
1969
1844
|
name: "clipping-axis",
|
|
1970
1845
|
value: "none",
|
|
1971
|
-
"onUpdate:modelValue":
|
|
1972
|
-
onChange:
|
|
1846
|
+
"onUpdate:modelValue": P[6] || (P[6] = (w) => et(n) ? n.value = w : null),
|
|
1847
|
+
onChange: P[7] || (P[7] = (...w) => A(R) && A(R)(...w))
|
|
1973
1848
|
}, null, 544), [
|
|
1974
|
-
[
|
|
1849
|
+
[it, A(n)]
|
|
1975
1850
|
]),
|
|
1976
|
-
|
|
1851
|
+
P[15] || (P[15] = p("span", { class: "radio-text" }, "无切割", -1))
|
|
1977
1852
|
]),
|
|
1978
|
-
|
|
1979
|
-
|
|
1853
|
+
p("label", _i, [
|
|
1854
|
+
X(p("input", {
|
|
1980
1855
|
type: "radio",
|
|
1981
1856
|
name: "clipping-axis",
|
|
1982
1857
|
value: "x",
|
|
1983
|
-
"onUpdate:modelValue":
|
|
1984
|
-
onChange:
|
|
1858
|
+
"onUpdate:modelValue": P[8] || (P[8] = (w) => et(n) ? n.value = w : null),
|
|
1859
|
+
onChange: P[9] || (P[9] = (...w) => A(R) && A(R)(...w))
|
|
1985
1860
|
}, null, 544), [
|
|
1986
|
-
[
|
|
1861
|
+
[it, A(n)]
|
|
1987
1862
|
]),
|
|
1988
|
-
|
|
1863
|
+
P[16] || (P[16] = p("span", { class: "radio-text" }, "X轴切割", -1))
|
|
1989
1864
|
]),
|
|
1990
|
-
|
|
1991
|
-
|
|
1865
|
+
p("label", ci, [
|
|
1866
|
+
X(p("input", {
|
|
1992
1867
|
type: "radio",
|
|
1993
1868
|
name: "clipping-axis",
|
|
1994
1869
|
value: "y",
|
|
1995
|
-
"onUpdate:modelValue":
|
|
1996
|
-
onChange:
|
|
1870
|
+
"onUpdate:modelValue": P[10] || (P[10] = (w) => et(n) ? n.value = w : null),
|
|
1871
|
+
onChange: P[11] || (P[11] = (...w) => A(R) && A(R)(...w))
|
|
1997
1872
|
}, null, 544), [
|
|
1998
|
-
[
|
|
1873
|
+
[it, A(n)]
|
|
1999
1874
|
]),
|
|
2000
|
-
|
|
1875
|
+
P[17] || (P[17] = p("span", { class: "radio-text" }, "Y轴切割", -1))
|
|
2001
1876
|
]),
|
|
2002
|
-
|
|
2003
|
-
|
|
1877
|
+
p("label", Pi, [
|
|
1878
|
+
X(p("input", {
|
|
2004
1879
|
type: "radio",
|
|
2005
1880
|
name: "clipping-axis",
|
|
2006
1881
|
value: "z",
|
|
2007
|
-
"onUpdate:modelValue":
|
|
2008
|
-
onChange:
|
|
1882
|
+
"onUpdate:modelValue": P[12] || (P[12] = (w) => et(n) ? n.value = w : null),
|
|
1883
|
+
onChange: P[13] || (P[13] = (...w) => A(R) && A(R)(...w))
|
|
2009
1884
|
}, null, 544), [
|
|
2010
|
-
[
|
|
1885
|
+
[it, A(n)]
|
|
2011
1886
|
]),
|
|
2012
|
-
|
|
1887
|
+
P[18] || (P[18] = p("span", { class: "radio-text" }, "Z轴切割", -1))
|
|
2013
1888
|
])
|
|
2014
1889
|
])
|
|
2015
|
-
])) :
|
|
1890
|
+
])) : q("", !0)
|
|
2016
1891
|
]),
|
|
2017
1892
|
_: 1
|
|
2018
1893
|
})
|
|
2019
1894
|
], 512), [
|
|
2020
|
-
[
|
|
1895
|
+
[ft, f.value]
|
|
2021
1896
|
]),
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
1897
|
+
X(p("div", Ji, [
|
|
1898
|
+
p("div", ui, [
|
|
1899
|
+
p("span", null, Y(O.value), 1),
|
|
1900
|
+
p("span", {
|
|
2026
1901
|
class: "close",
|
|
2027
|
-
onClick:
|
|
1902
|
+
onClick: P[14] || (P[14] = (w) => x.value = !1)
|
|
2028
1903
|
}, " X ")
|
|
2029
1904
|
]),
|
|
2030
|
-
|
|
2031
|
-
default:
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
1905
|
+
B(Z, { "max-height": "650px" }, {
|
|
1906
|
+
default: mt(() => [
|
|
1907
|
+
O.value === "关节控制" ? (z(), Gt(qe, {
|
|
1908
|
+
key: 0,
|
|
1909
|
+
model: A(V),
|
|
1910
|
+
scene: A(e)
|
|
1911
|
+
}, null, 8, ["model", "scene"])) : q("", !0)
|
|
2036
1912
|
]),
|
|
2037
1913
|
_: 1
|
|
2038
1914
|
})
|
|
2039
1915
|
], 512), [
|
|
2040
|
-
[
|
|
1916
|
+
[ft, x.value]
|
|
2041
1917
|
]),
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
])) :
|
|
1918
|
+
u.value ? (z(), j("div", pi, [
|
|
1919
|
+
P[19] || (P[19] = p("div", { class: "loading-spinner" }, null, -1)),
|
|
1920
|
+
p("p", null, Y(s.value), 1)
|
|
1921
|
+
])) : q("", !0)
|
|
2046
1922
|
]);
|
|
2047
1923
|
};
|
|
2048
1924
|
}
|
|
2049
|
-
},
|
|
1925
|
+
}, yi = /* @__PURE__ */ Q(mi, [["__scopeId", "data-v-3e87dec6"]]);
|
|
2050
1926
|
export {
|
|
2051
|
-
|
|
1927
|
+
yi as default
|
|
2052
1928
|
};
|