ss-component-new 1.2.5 → 1.2.6
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/OrbitControls-Co_9huz0.cjs +1 -0
- package/dist/OrbitControls-DA4VpOM_.js +458 -0
- package/dist/STLLoader-DmGTF0Nv.js +657 -0
- package/dist/STLLoader-RU7KqloS.cjs +6 -0
- package/dist/{animationData-C-RfOMuc.cjs → animationData-B0K2ghu6.cjs} +1 -1
- package/dist/{animationData-y8dsr3_3.js → animationData-GqECkAbz.js} +4 -4
- package/dist/{array-A59WrroX.js → array-D65aMM6H.js} +1 -1
- package/dist/{array-BtZq8qON.cjs → array-DMPAgNcb.cjs} +1 -1
- package/dist/{iconfont-7cEds3Xj.js → iconfont-ljBfzBSE.js} +2 -2
- package/dist/{iconfont-CsuwJCas.cjs → iconfont-t5epssvu.cjs} +1 -1
- package/dist/{index-CIH_h4z2.js → index--rLSLEk3.js} +2 -2
- package/dist/{index-BstfB43W.cjs → index-67QO-qDa.cjs} +1 -1
- package/dist/{index-DTOlfKkI.cjs → index-87kRWJv8.cjs} +1 -1
- package/dist/{index-Y9ssLsHN.js → index-8Dyi4QCI.js} +183 -184
- package/dist/{index-CxOoKysB.cjs → index-8yRiF_z8.cjs} +1 -1
- package/dist/{index-CwnxmCht.js → index-9zEdW6xv.js} +2 -2
- package/dist/{index-DQP6am4n.cjs → index-B14iwpkN.cjs} +1 -1
- package/dist/{index-De5HlcQy.cjs → index-B7hLDNQ6.cjs} +1 -1
- package/dist/{index-Cli0OESv.js → index-BEoEUXZe.js} +10 -10
- package/dist/{index-DLBS_tgM.cjs → index-BHJ-tVLT.cjs} +1 -1
- package/dist/{index-DX6yycjK.js → index-BMMYAqF1.js} +1 -1
- package/dist/{index-DSb6SjE3.js → index-BNOx3XL5.js} +1 -1
- package/dist/{index-C5z5UbxK.cjs → index-BNvpuVyw.cjs} +1 -1
- package/dist/{index-1z9RrjZc.cjs → index-BOJUyAaV.cjs} +1 -1
- package/dist/{index-D2ZBhyUI.cjs → index-BYUPvuvs.cjs} +1 -1
- package/dist/{index-CKowlJfn.cjs → index-BaRkv5oc.cjs} +1 -1
- package/dist/{index-C1oE8qIa.cjs → index-BpR7F1Fp.cjs} +1 -1
- package/dist/{index-BLgbZvdb.js → index-Bs2K1FVH.js} +2 -2
- package/dist/{index-NcJvspI2.cjs → index-BsM9qdbC.cjs} +1 -1
- package/dist/{index-B8mnYY10.js → index-BsfJJu0R.js} +6 -6
- package/dist/{index-BCbxnJnH.js → index-Bw_JtuzR.js} +152 -152
- package/dist/{index-C461j30b.js → index-C1FOuBuy.js} +1 -1
- package/dist/{index-COKoQtgg.cjs → index-C5CKSB0e.cjs} +1 -1
- package/dist/{index-Bc4DtcwM.js → index-C8UOMPgt.js} +2 -2
- package/dist/{index-3W-Y0xpv.cjs → index-CA-FC_OL.cjs} +1 -1
- package/dist/{index-DNaqgwk-.js → index-CArSUfnV.js} +20 -20
- package/dist/{index-DU_1ks22.js → index-CBuqdsPh.js} +4 -4
- package/dist/{index-C_GxFCMg.js → index-CMCrQ36H.js} +3 -3
- package/dist/{index-DYU11-M5.js → index-CRj9VM12.js} +6 -6
- package/dist/{index-700WRwjB.js → index-CRrAiL5l.js} +4 -4
- package/dist/{index-Dzrvm_bg.js → index-CShBWCYm.js} +1 -1
- package/dist/{index-BwjuTBrR.js → index-CTkF2kl_.js} +1 -1
- package/dist/{index-COV5L9rX.cjs → index-CZaBF851.cjs} +1 -1
- package/dist/{index-DTCYk2wI.js → index-CbA74tCL.js} +2 -2
- package/dist/{index-DgymXtI4.js → index-CbDu4gfZ.js} +2 -2
- package/dist/{index-Bxyl11ug.cjs → index-CePZE-QA.cjs} +1 -1
- package/dist/{index-DIOVPmEg.cjs → index-CedgKpsz.cjs} +1 -1
- package/dist/{index-O8If5b4T.cjs → index-Cm3z0Vmi.cjs} +1 -1
- package/dist/{index-Cj8I0l8I.js → index-D-WcrLQv.js} +4 -4
- package/dist/{index-OsCw48Sn.cjs → index-D6mwkqWY.cjs} +1 -1
- package/dist/{index-BKJg9Djt.cjs → index-D8510-YQ.cjs} +1 -1
- package/dist/{index-Bb7Xqt9a.cjs → index-D9oqICYV.cjs} +1 -1
- package/dist/{index-BvApH9cT.js → index-DGepdvRW.js} +2 -2
- package/dist/{index-ByVPv-Yz.js → index-DGi-ANHr.js} +5 -5
- package/dist/{index-C4zGJtAL.js → index-DJGsDpDp.js} +3 -3
- package/dist/{index-CIcvrh1S.cjs → index-DPBmAgEA.cjs} +1 -1
- package/dist/{index-yQZ9D_YR.js → index-DPWc4No_.js} +2 -2
- package/dist/{index-CxnH4vfV.cjs → index-DSchKIyh.cjs} +1 -1
- package/dist/{index-CYp77kPp.js → index-DV_ZZQBO.js} +1 -1
- package/dist/{index-D8WF1ILq.cjs → index-DVmoPvzr.cjs} +1 -1
- package/dist/{index-DWrDb90D.cjs → index-DWs7-g1h.cjs} +1 -1
- package/dist/{index-HvKkM5Lq.cjs → index-DZ8a7BZ1.cjs} +1 -1
- package/dist/{index-Y6CA0bCm.cjs → index-DcUUpSE1.cjs} +1 -1
- package/dist/{index-CX_HTfbe.js → index-DvpVQvAe.js} +2 -2
- package/dist/{index-DYx6r9hf.cjs → index-FK1YYpjN.cjs} +1 -1
- package/dist/{index-BYDi6Owv.js → index-HvKjB6_P.js} +3 -3
- package/dist/{index-DPk1uhLn.js → index-LADv0t0E.js} +12 -12
- package/dist/{index-D3-XwkD_.js → index-_66uQhcl.js} +6 -6
- package/dist/{index-CJK74ski.cjs → index-_uyv24Pt.cjs} +1 -1
- package/dist/{index-CdELRsxO.js → index-g4qw0jRy.js} +6 -6
- package/dist/{index-GmZ7sLUW.cjs → index-mtuIEfrj.cjs} +1 -1
- package/dist/{index-CjI5pDiU.cjs → index-tttYIzsn.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DLUx599w.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BSOYWm_U.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BhLzDN6s.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DIMJusrg.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-llikchjv.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-D2VLEzGB.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-D-2EkcBi.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-D58IzjOR.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-DiMotFL8.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BnNwKutS.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-DodcXWpb.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CJCvJvBM.js} +13 -13
- package/dist/{index.vue_vue_type_style_index_1_lang-CFvcnWO4.js → index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-BJQzMo8k.cjs → index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs} +46 -45
- package/dist/{index.vue_vue_type_style_index_1_lang-BcYTED7W.cjs → index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-BMzWMYje.js → index.vue_vue_type_style_index_1_lang-hBa3nAgx.js} +5100 -5012
- package/dist/{isString-BNK38WbE.js → isString--ZVOCy4V.js} +1 -1
- package/dist/{isString-BmAegMGI.cjs → isString-CELwppr9.cjs} +1 -1
- package/dist/{main-C3-nmz2f.cjs → main-C6Iw-pcH.cjs} +1 -1
- package/dist/{main-DS4xl7Jm.js → main-CygliYyN.js} +5 -5
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +11 -11
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +12 -12
- package/dist/three-viewport-gizmo-BHznJ6W3.js +26015 -0
- package/dist/three-viewport-gizmo-BV37JzRa.cjs +4197 -0
- package/dist/{threeLatheView-BzHB-t_G.cjs → threeLatheView-CdUoB0Te.cjs} +1 -1
- package/dist/{threeLatheView-sTBlm0tt.js → threeLatheView-DzpPpdDr.js} +4 -4
- package/dist/{threeModel-BoNyasP7.cjs → threeModel-BUCLJlE5.cjs} +1 -1
- package/dist/{threeModel-CaxS7sQg.js → threeModel-BfMMeZCc.js} +5 -5
- package/dist/threePreview-BEqzg370.js +1972 -0
- package/dist/threePreview-C-JW_pcY.cjs +1 -0
- package/dist/{threeSceneView-wQdzFhdw.cjs → threeSceneView-BTsG2QJg.cjs} +1 -1
- package/dist/{threeSceneView-BIAOu60U.js → threeSceneView-DV5dsTZZ.js} +24 -24
- package/dist/{threeSceneViewForCPMPIP-XYA9PRYN.js → threeSceneViewForCPMPIP-Bexwqkry.js} +27 -27
- package/dist/{threeSceneViewForCPMPIP-Bkr16khM.cjs → threeSceneViewForCPMPIP-DwLWGNUd.cjs} +2 -2
- package/dist/{threeViewerHost-D1i6LUb6.cjs → threeViewerHost-CRqcYbJE.cjs} +1 -1
- package/dist/{threeViewerHost-BkOYLPdk.js → threeViewerHost-CTjd2V1D.js} +4 -4
- package/dist/{useRayCaster-CdDOIWOo.js → useRayCaster-D0_7oJan.js} +12 -12
- package/dist/{useRayCaster-0bnGc301.cjs → useRayCaster-DN56HpNP.cjs} +1 -1
- package/package.json +1 -1
- package/dist/OrbitControls-D1lM0xvz.cjs +0 -1
- package/dist/OrbitControls-DI8fa9gz.js +0 -419
- package/dist/STLLoader-KxFIlfhN.cjs +0 -6
- package/dist/STLLoader-memlq1bT.js +0 -609
- package/dist/three-viewport-gizmo-BxFHxv_x.js +0 -18587
- package/dist/three-viewport-gizmo-CwaL5sMV.cjs +0 -4195
- package/dist/threePreview-Cy7NY-gw.cjs +0 -1
- package/dist/threePreview-DPyqhBkJ.js +0 -1873
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed as _, defineComponent as z, defineAsyncComponent as S, ref as A, watch as G, createElementBlock as M, openBlock as E, normalizeClass as j, createBlock as b, createCommentVNode as B, unref as P } from "vue";
|
|
2
|
-
import { a as L, b$ as Y, p as I, s as O } from "./index-
|
|
3
|
-
import { u as H } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
2
|
+
import { a as L, b$ as Y, p as I, s as O } from "./index-DV_ZZQBO.js";
|
|
3
|
+
import { u as H } from "./index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js";
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DIMJusrg.js";
|
|
5
5
|
import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
6
|
function se(u) {
|
|
7
7
|
const d = sessionStorage.getItem("loginToken") ?? "123456";
|
|
@@ -125,7 +125,7 @@ const X = {
|
|
|
125
125
|
},
|
|
126
126
|
emits: ["getThreeData"],
|
|
127
127
|
setup(u, { emit: d }) {
|
|
128
|
-
const h = S(() => import("./threeSceneView-
|
|
128
|
+
const h = S(() => import("./threeSceneView-DV5dsTZZ.js")), D = S(() => import("./threePreview-BEqzg370.js")), f = S(() => import("./threeLatheView-DzpPpdDr.js")), T = S(() => import("./threeSceneViewForCPMPIP-Bexwqkry.js")), o = {
|
|
129
129
|
ROBOT_SCENE: "robot",
|
|
130
130
|
// 机器人场景
|
|
131
131
|
LATHE_SCENE: "latheScene",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var de = Object.defineProperty;
|
|
2
2
|
var me = (n, s, t) => s in n ? de(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
|
|
3
3
|
var x = (n, s, t) => me(n, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { U as pe } from "./index.vue_vue_type_style_index_1_lang-hBa3nAgx.js";
|
|
5
|
+
import { S as ve, M as fe, O as be } from "./STLLoader-DmGTF0Nv.js";
|
|
6
|
+
import { ay as we, o as E, h as he, e as _e, B as ge, V as z, Q as Me, E as ye, az as Re, J as Se } from "./three-viewport-gizmo-BHznJ6W3.js";
|
|
7
7
|
import { defineComponent as $e, ref as V, computed as D, watch as ue, resolveComponent as J, createElementBlock as j, openBlock as I, createVNode as F, createElementVNode as c, withCtx as L, createTextVNode as U, toDisplayString as C } from "vue";
|
|
8
8
|
import { _ as Fe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
9
9
|
const ct = {
|
|
@@ -29,7 +29,7 @@ function ce(n) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
function Oe(n) {
|
|
32
|
-
const { manager: s, baseFolderUrl: t, onFileProgress: i } = n, m = new
|
|
32
|
+
const { manager: s, baseFolderUrl: t, onFileProgress: i } = n, m = new pe(s);
|
|
33
33
|
return m.packages = (l) => `${t.endsWith("/") ? t : t + "/"}${l}/`, m.loadMeshCb = (l, y, h) => {
|
|
34
34
|
const R = (() => {
|
|
35
35
|
const g = l.split("?")[0].split("#")[0], u = g.lastIndexOf(".");
|
|
@@ -49,7 +49,7 @@ function Oe(n) {
|
|
|
49
49
|
var v;
|
|
50
50
|
return (((v = l.split("/").pop()) == null ? void 0 : v.split("?")[0].split("#")[0]) ?? "").replace(/\.[^/.?#]+$/, "");
|
|
51
51
|
})(), f = `${g}${u}.mtl`, M = (r) => {
|
|
52
|
-
const v = new
|
|
52
|
+
const v = new be(y);
|
|
53
53
|
r && v.setMaterials(r), v.load(
|
|
54
54
|
l,
|
|
55
55
|
(w) => h(w),
|
|
@@ -58,7 +58,7 @@ function Oe(n) {
|
|
|
58
58
|
console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${l}`, w), h(new E());
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
|
-
}, b = new
|
|
61
|
+
}, b = new fe(y);
|
|
62
62
|
b.setResourcePath(g), b.load(
|
|
63
63
|
f,
|
|
64
64
|
(r) => {
|
|
@@ -76,10 +76,10 @@ function Oe(n) {
|
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "stl": {
|
|
79
|
-
new
|
|
79
|
+
new ve(y).load(
|
|
80
80
|
l,
|
|
81
81
|
(u) => {
|
|
82
|
-
const f = new
|
|
82
|
+
const f = new he({ color: 12303291, shininess: 30 }), M = new _e(u, f);
|
|
83
83
|
M.castShadow = !0, M.receiveShadow = !0, h(M);
|
|
84
84
|
},
|
|
85
85
|
(u) => i == null ? void 0 : i(l, u == null ? void 0 : u.loaded, u == null ? void 0 : u.total),
|
|
@@ -98,7 +98,7 @@ function mt(n, s, t, i) {
|
|
|
98
98
|
return { loadSceneFromFile: (l) => new Promise((y, h) => {
|
|
99
99
|
t.value = !0, i.value = "正在初始化 URDF 加载器...";
|
|
100
100
|
let R = 0, g = 0, u = null;
|
|
101
|
-
const f = new
|
|
101
|
+
const f = new we();
|
|
102
102
|
f.onStart = (b, r, v) => {
|
|
103
103
|
R = v || 0, g = r || 0, i.value = R > 0 ? `开始下载资源: 0 / ${R}` : "开始下载资源...", t.value = !0;
|
|
104
104
|
}, f.onProgress = (b, r, v) => {
|
|
@@ -107,7 +107,7 @@ function mt(n, s, t, i) {
|
|
|
107
107
|
i.value = w, r === v && (i.value = "资源加载完成,正在处理模型...", setTimeout(() => {
|
|
108
108
|
if (u) {
|
|
109
109
|
u.updateMatrixWorld(!0);
|
|
110
|
-
const p = new
|
|
110
|
+
const p = new ge().setFromObject(u);
|
|
111
111
|
p.isEmpty() && console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"), u.userData.boundingBox = p, u.traverse((d) => {
|
|
112
112
|
d.isMesh && (d.castShadow = !0, d.receiveShadow = !0);
|
|
113
113
|
}), y(u);
|
|
@@ -246,7 +246,7 @@ class pt {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
const De = (n, s = "YZX") => {
|
|
249
|
-
const t = new z(), i = new
|
|
249
|
+
const t = new z(), i = new Me(), m = new z(), l = new ye();
|
|
250
250
|
n.getWorldPosition(t), n.getWorldQuaternion(i), n.getWorldScale(m), l.setFromQuaternion(i, s);
|
|
251
251
|
const y = {
|
|
252
252
|
x: n.rotation.x * 180 / Math.PI,
|
|
@@ -520,7 +520,7 @@ const De = (n, s = "YZX") => {
|
|
|
520
520
|
}), vt = /* @__PURE__ */ Fe(st, [["__scopeId", "data-v-00d48931"]]);
|
|
521
521
|
function ft(n, s, t, i = ["URDFVisual"]) {
|
|
522
522
|
let m = null;
|
|
523
|
-
const l = V(null), y = new
|
|
523
|
+
const l = V(null), y = new Re(), h = new Se(), R = /* @__PURE__ */ new Map();
|
|
524
524
|
function g() {
|
|
525
525
|
t.value.forEach((p) => {
|
|
526
526
|
p.traverse((d) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const R=require("./three-viewport-gizmo-CwaL5sMV.cjs"),se=require("./index.vue_vue_type_style_index_1_lang-BJQzMo8k.cjs"),C=require("./STLLoader-KxFIlfhN.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机",DOUBLE:"双机"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|
|
1
|
+
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const se=require("./index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs"),C=require("./STLLoader-RU7KqloS.cjs"),R=require("./three-viewport-gizmo-BV37JzRa.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机",DOUBLE:"双机"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./three-viewport-gizmo-CwaL5sMV.cjs"),ye={type:"change"},B={type:"start"},ge={type:"end"},_=new n.Ray,Ee=new n.Plane,_e=Math.cos(70*n.MathUtils.DEG2RAD);class He extends n.EventDispatcher{constructor(H,Te){super(),this.object=H,this.domElement=Te,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new n.Vector3,this.cursor=new n.Vector3,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=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=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:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},this.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",q),this._domElementKeyEvents=t},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",q),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(ye),e.update(),c=i.NONE},this.update=function(){const t=new n.Vector3,o=new n.Quaternion().setFromUnitVectors(H.up,new n.Vector3(0,1,0)),a=o.clone().invert(),s=new n.Vector3,u=new n.Quaternion,y=new n.Vector3,d=2*Math.PI;return function(Ve=null){const fe=e.object.position;t.copy(fe).sub(e.target),t.applyQuaternion(o),r.setFromVector3(t),e.autoRotate&&c===i.NONE&&N(Pe(Ve)),e.enableDamping?(r.theta+=m.theta*e.dampingFactor,r.phi+=m.phi*e.dampingFactor):(r.theta+=m.theta,r.phi+=m.phi);let p=e.minAzimuthAngle,h=e.maxAzimuthAngle;isFinite(p)&&isFinite(h)&&(p<-Math.PI?p+=d:p>Math.PI&&(p-=d),h<-Math.PI?h+=d:h>Math.PI&&(h-=d),p<=h?r.theta=Math.max(p,Math.min(h,r.theta)):r.theta=r.theta>(p+h)/2?Math.max(p,r.theta):Math.min(h,r.theta)),r.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,r.phi)),r.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(w,e.dampingFactor):e.target.add(w),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor);let C=!1;if(e.zoomToCursor&&Y||e.object.isOrthographicCamera)r.radius=W(r.radius);else{const f=r.radius;r.radius=W(r.radius*g),C=f!=r.radius}if(t.setFromSpherical(r),t.applyQuaternion(a),fe.copy(e.target).add(t),e.object.lookAt(e.target),e.enableDamping===!0?(m.theta*=1-e.dampingFactor,m.phi*=1-e.dampingFactor,w.multiplyScalar(1-e.dampingFactor)):(m.set(0,0,0),w.set(0,0,0)),e.zoomToCursor&&Y){let f=null;if(e.object.isPerspectiveCamera){const I=t.length();f=W(I*g);const V=I-f;e.object.position.addScaledVector(Q,V),e.object.updateMatrixWorld(),C=!!V}else if(e.object.isOrthographicCamera){const I=new n.Vector3(b.x,b.y,0);I.unproject(e.object);const V=e.object.zoom;e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/g)),e.object.updateProjectionMatrix(),C=V!==e.object.zoom;const be=new n.Vector3(b.x,b.y,0);be.unproject(e.object),e.object.position.sub(be).add(I),e.object.updateMatrixWorld(),f=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;f!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(f).add(e.object.position):(_.origin.copy(e.object.position),_.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(_.direction))<_e?H.lookAt(e.target):(Ee.setFromNormalAndCoplanarPoint(e.object.up,e.target),_.intersectPlane(Ee,e.target))))}else if(e.object.isOrthographicCamera){const f=e.object.zoom;e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/g)),f!==e.object.zoom&&(e.object.updateProjectionMatrix(),C=!0)}return g=1,Y=!1,C||s.distanceToSquared(e.object.position)>K||8*(1-u.dot(e.object.quaternion))>K||y.distanceToSquared(e.target)>K?(e.dispatchEvent(ye),s.copy(e.object.position),u.copy(e.object.quaternion),y.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",pe),e.domElement.removeEventListener("pointerdown",ce),e.domElement.removeEventListener("pointercancel",k),e.domElement.removeEventListener("wheel",le),e.domElement.removeEventListener("pointermove",G),e.domElement.removeEventListener("pointerup",k),e.domElement.getRootNode().removeEventListener("keydown",ue,{capture:!0}),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",q),e._domElementKeyEvents=null)};const e=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=i.NONE;const K=1e-6,r=new n.Spherical,m=new n.Spherical;let g=1;const w=new n.Vector3,E=new n.Vector2,T=new n.Vector2,j=new n.Vector2,P=new n.Vector2,O=new n.Vector2,A=new n.Vector2,L=new n.Vector2,D=new n.Vector2,M=new n.Vector2,Q=new n.Vector3,b=new n.Vector2;let Y=!1;const l=[],x={};let Z=!1;function Pe(t){return t!==null?2*Math.PI/60*e.autoRotateSpeed*t:2*Math.PI/60/60*e.autoRotateSpeed}function z(t){const o=Math.abs(t*.01);return Math.pow(.95,e.zoomSpeed*o)}function N(t){m.theta-=t}function U(t){m.phi-=t}const v=function(){const t=new n.Vector3;return function(a,s){t.setFromMatrixColumn(s,0),t.multiplyScalar(-a),w.add(t)}}(),J=function(){const t=new n.Vector3;return function(a,s){e.screenSpacePanning===!0?t.setFromMatrixColumn(s,1):(t.setFromMatrixColumn(s,0),t.crossVectors(e.object.up,t)),t.multiplyScalar(a),w.add(t)}}(),R=function(){const t=new n.Vector3;return function(a,s){const u=e.domElement;if(e.object.isPerspectiveCamera){const y=e.object.position;t.copy(y).sub(e.target);let d=t.length();d*=Math.tan(e.object.fov/2*Math.PI/180),v(2*a*d/u.clientHeight,e.object.matrix),J(2*s*d/u.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(v(a*(e.object.right-e.object.left)/e.object.zoom/u.clientWidth,e.object.matrix),J(s*(e.object.top-e.object.bottom)/e.object.zoom/u.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function X(t){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?g/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function $(t){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?g*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function F(t,o){if(!e.zoomToCursor)return;Y=!0;const a=e.domElement.getBoundingClientRect(),s=t-a.left,u=o-a.top,y=a.width,d=a.height;b.x=s/y*2-1,b.y=-(u/d)*2+1,Q.set(b.x,b.y,1).unproject(e.object).sub(e.object.position).normalize()}function W(t){return Math.max(e.minDistance,Math.min(e.maxDistance,t))}function ee(t){E.set(t.clientX,t.clientY)}function Oe(t){F(t.clientX,t.clientX),L.set(t.clientX,t.clientY)}function te(t){P.set(t.clientX,t.clientY)}function Me(t){T.set(t.clientX,t.clientY),j.subVectors(T,E).multiplyScalar(e.rotateSpeed);const o=e.domElement;N(2*Math.PI*j.x/o.clientHeight),U(2*Math.PI*j.y/o.clientHeight),E.copy(T),e.update()}function we(t){D.set(t.clientX,t.clientY),M.subVectors(D,L),M.y>0?X(z(M.y)):M.y<0&&$(z(M.y)),L.copy(D),e.update()}function je(t){O.set(t.clientX,t.clientY),A.subVectors(O,P).multiplyScalar(e.panSpeed),R(A.x,A.y),P.copy(O),e.update()}function Ae(t){F(t.clientX,t.clientY),t.deltaY<0?$(z(t.deltaY)):t.deltaY>0&&X(z(t.deltaY)),e.update()}function Le(t){let o=!1;switch(t.code){case e.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?U(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):R(0,e.keyPanSpeed),o=!0;break;case e.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?U(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):R(0,-e.keyPanSpeed),o=!0;break;case e.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?N(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):R(e.keyPanSpeed,0),o=!0;break;case e.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?N(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):R(-e.keyPanSpeed,0),o=!0;break}o&&(t.preventDefault(),e.update())}function oe(t){if(l.length===1)E.set(t.pageX,t.pageY);else{const o=S(t),a=.5*(t.pageX+o.x),s=.5*(t.pageY+o.y);E.set(a,s)}}function ne(t){if(l.length===1)P.set(t.pageX,t.pageY);else{const o=S(t),a=.5*(t.pageX+o.x),s=.5*(t.pageY+o.y);P.set(a,s)}}function ae(t){const o=S(t),a=t.pageX-o.x,s=t.pageY-o.y,u=Math.sqrt(a*a+s*s);L.set(0,u)}function De(t){e.enableZoom&&ae(t),e.enablePan&&ne(t)}function Re(t){e.enableZoom&&ae(t),e.enableRotate&&oe(t)}function ie(t){if(l.length==1)T.set(t.pageX,t.pageY);else{const a=S(t),s=.5*(t.pageX+a.x),u=.5*(t.pageY+a.y);T.set(s,u)}j.subVectors(T,E).multiplyScalar(e.rotateSpeed);const o=e.domElement;N(2*Math.PI*j.x/o.clientHeight),U(2*Math.PI*j.y/o.clientHeight),E.copy(T)}function se(t){if(l.length===1)O.set(t.pageX,t.pageY);else{const o=S(t),a=.5*(t.pageX+o.x),s=.5*(t.pageY+o.y);O.set(a,s)}A.subVectors(O,P).multiplyScalar(e.panSpeed),R(A.x,A.y),P.copy(O)}function re(t){const o=S(t),a=t.pageX-o.x,s=t.pageY-o.y,u=Math.sqrt(a*a+s*s);D.set(0,u),M.set(0,Math.pow(D.y/L.y,e.zoomSpeed)),X(M.y),L.copy(D);const y=(t.pageX+o.x)*.5,d=(t.pageY+o.y)*.5;F(y,d)}function Se(t){e.enableZoom&&re(t),e.enablePan&&se(t)}function xe(t){e.enableZoom&&re(t),e.enableRotate&&ie(t)}function ce(t){e.enabled!==!1&&(l.length===0&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",G),e.domElement.addEventListener("pointerup",k)),!Ue(t)&&(Ye(t),t.pointerType==="touch"?me(t):Ne(t)))}function G(t){e.enabled!==!1&&(t.pointerType==="touch"?Ie(t):ke(t))}function k(t){switch(ze(t),l.length){case 0:e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",G),e.domElement.removeEventListener("pointerup",k),e.dispatchEvent(ge),c=i.NONE;break;case 1:const o=l[0],a=x[o];me({pointerId:o,pageX:a.x,pageY:a.y});break}}function Ne(t){let o;switch(t.button){case 0:o=e.mouseButtons.LEFT;break;case 1:o=e.mouseButtons.MIDDLE;break;case 2:o=e.mouseButtons.RIGHT;break;default:o=-1}switch(o){case n.MOUSE.DOLLY:if(e.enableZoom===!1)return;Oe(t),c=i.DOLLY;break;case n.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enablePan===!1)return;te(t),c=i.PAN}else{if(e.enableRotate===!1)return;ee(t),c=i.ROTATE}break;case n.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enableRotate===!1)return;ee(t),c=i.ROTATE}else{if(e.enablePan===!1)return;te(t),c=i.PAN}break;default:c=i.NONE}c!==i.NONE&&e.dispatchEvent(B)}function ke(t){switch(c){case i.ROTATE:if(e.enableRotate===!1)return;Me(t);break;case i.DOLLY:if(e.enableZoom===!1)return;we(t);break;case i.PAN:if(e.enablePan===!1)return;je(t);break}}function le(t){e.enabled===!1||e.enableZoom===!1||c!==i.NONE||(t.preventDefault(),e.dispatchEvent(B),Ae(Ce(t)),e.dispatchEvent(ge))}function Ce(t){const o=t.deltaMode,a={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(o){case 1:a.deltaY*=16;break;case 2:a.deltaY*=100;break}return t.ctrlKey&&!Z&&(a.deltaY*=10),a}function ue(t){t.key==="Control"&&(Z=!0,e.domElement.getRootNode().addEventListener("keyup",de,{passive:!0,capture:!0}))}function de(t){t.key==="Control"&&(Z=!1,e.domElement.getRootNode().removeEventListener("keyup",de,{passive:!0,capture:!0}))}function q(t){e.enabled===!1||e.enablePan===!1||Le(t)}function me(t){switch(he(t),l.length){case 1:switch(e.touches.ONE){case n.TOUCH.ROTATE:if(e.enableRotate===!1)return;oe(t),c=i.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(e.enablePan===!1)return;ne(t),c=i.TOUCH_PAN;break;default:c=i.NONE}break;case 2:switch(e.touches.TWO){case n.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;De(t),c=i.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Re(t),c=i.TOUCH_DOLLY_ROTATE;break;default:c=i.NONE}break;default:c=i.NONE}c!==i.NONE&&e.dispatchEvent(B)}function Ie(t){switch(he(t),c){case i.TOUCH_ROTATE:if(e.enableRotate===!1)return;ie(t),e.update();break;case i.TOUCH_PAN:if(e.enablePan===!1)return;se(t),e.update();break;case i.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Se(t),e.update();break;case i.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;xe(t),e.update();break;default:c=i.NONE}}function pe(t){e.enabled!==!1&&t.preventDefault()}function Ye(t){l.push(t.pointerId)}function ze(t){delete x[t.pointerId];for(let o=0;o<l.length;o++)if(l[o]==t.pointerId){l.splice(o,1);return}}function Ue(t){for(let o=0;o<l.length;o++)if(l[o]==t.pointerId)return!0;return!1}function he(t){let o=x[t.pointerId];o===void 0&&(o=new n.Vector2,x[t.pointerId]=o),o.set(t.pageX,t.pageY)}function S(t){const o=t.pointerId===l[0]?l[1]:l[0];return x[o]}e.domElement.addEventListener("contextmenu",pe),e.domElement.addEventListener("pointerdown",ce),e.domElement.addEventListener("pointercancel",k),e.domElement.addEventListener("wheel",le,{passive:!1}),e.domElement.getRootNode().addEventListener("keydown",ue,{passive:!0,capture:!0}),this.update()}}exports.OrbitControls=He;
|
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
import { aJ as Ve, V as u, M as k, aK as S, aL as Pe, Q as Te, J as m, aM as We, j as Ge, l as qe } from "./three-viewport-gizmo-BxFHxv_x.js";
|
|
2
|
-
const Oe = { type: "change" }, J = { type: "start" }, we = { type: "end" }, X = new We(), Me = new Ge(), Be = Math.cos(70 * qe.DEG2RAD);
|
|
3
|
-
class et extends Ve {
|
|
4
|
-
constructor(F, je) {
|
|
5
|
-
super(), this.object = F, this.domElement = je, this.domElement.style.touchAction = "none", this.enabled = !0, this.target = new u(), this.cursor = new u(), 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.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: k.ROTATE, MIDDLE: k.DOLLY, RIGHT: k.PAN }, this.touches = { ONE: S.ROTATE, TWO: S.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this.getPolarAngle = function() {
|
|
6
|
-
return s.phi;
|
|
7
|
-
}, this.getAzimuthalAngle = function() {
|
|
8
|
-
return s.theta;
|
|
9
|
-
}, this.getDistance = function() {
|
|
10
|
-
return this.object.position.distanceTo(this.target);
|
|
11
|
-
}, this.listenToKeyEvents = function(t) {
|
|
12
|
-
t.addEventListener("keydown", v), this._domElementKeyEvents = t;
|
|
13
|
-
}, this.stopListenToKeyEvents = function() {
|
|
14
|
-
this._domElementKeyEvents.removeEventListener("keydown", v), this._domElementKeyEvents = null;
|
|
15
|
-
}, this.saveState = function() {
|
|
16
|
-
e.target0.copy(e.target), e.position0.copy(e.object.position), e.zoom0 = e.object.zoom;
|
|
17
|
-
}, this.reset = function() {
|
|
18
|
-
e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(Oe), e.update(), r = a.NONE;
|
|
19
|
-
}, this.update = function() {
|
|
20
|
-
const t = new u(), o = new Te().setFromUnitVectors(F.up, new u(0, 1, 0)), n = o.clone().invert(), i = new u(), l = new Te(), g = new u(), d = 2 * Math.PI;
|
|
21
|
-
return function(Fe = null) {
|
|
22
|
-
const ge = e.object.position;
|
|
23
|
-
t.copy(ge).sub(e.target), t.applyQuaternion(o), s.setFromVector3(t), e.autoRotate && r === a.NONE && C(Ae(Fe)), e.enableDamping ? (s.theta += p.theta * e.dampingFactor, s.phi += p.phi * e.dampingFactor) : (s.theta += p.theta, s.phi += p.phi);
|
|
24
|
-
let h = e.minAzimuthAngle, f = e.maxAzimuthAngle;
|
|
25
|
-
isFinite(h) && isFinite(f) && (h < -Math.PI ? h += d : h > Math.PI && (h -= d), f < -Math.PI ? f += d : f > Math.PI && (f -= d), h <= f ? s.theta = Math.max(h, Math.min(f, s.theta)) : s.theta = s.theta > (h + f) / 2 ? Math.max(h, s.theta) : Math.min(f, s.theta)), s.phi = Math.max(e.minPolarAngle, Math.min(e.maxPolarAngle, s.phi)), s.makeSafe(), e.enableDamping === !0 ? e.target.addScaledVector(j, e.dampingFactor) : e.target.add(j), e.target.sub(e.cursor), e.target.clampLength(e.minTargetRadius, e.maxTargetRadius), e.target.add(e.cursor);
|
|
26
|
-
let z = !1;
|
|
27
|
-
if (e.zoomToCursor && K || e.object.isOrthographicCamera)
|
|
28
|
-
s.radius = B(s.radius);
|
|
29
|
-
else {
|
|
30
|
-
const b = s.radius;
|
|
31
|
-
s.radius = B(s.radius * E), z = b != s.radius;
|
|
32
|
-
}
|
|
33
|
-
if (t.setFromSpherical(s), t.applyQuaternion(n), ge.copy(e.target).add(t), e.object.lookAt(e.target), e.enableDamping === !0 ? (p.theta *= 1 - e.dampingFactor, p.phi *= 1 - e.dampingFactor, j.multiplyScalar(1 - e.dampingFactor)) : (p.set(0, 0, 0), j.set(0, 0, 0)), e.zoomToCursor && K) {
|
|
34
|
-
let b = null;
|
|
35
|
-
if (e.object.isPerspectiveCamera) {
|
|
36
|
-
const _ = t.length();
|
|
37
|
-
b = B(_ * E);
|
|
38
|
-
const Z = _ - b;
|
|
39
|
-
e.object.position.addScaledVector($, Z), e.object.updateMatrixWorld(), z = !!Z;
|
|
40
|
-
} else if (e.object.isOrthographicCamera) {
|
|
41
|
-
const _ = new u(y.x, y.y, 0);
|
|
42
|
-
_.unproject(e.object);
|
|
43
|
-
const Z = e.object.zoom;
|
|
44
|
-
e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / E)), e.object.updateProjectionMatrix(), z = Z !== e.object.zoom;
|
|
45
|
-
const Ee = new u(y.x, y.y, 0);
|
|
46
|
-
Ee.unproject(e.object), e.object.position.sub(Ee).add(_), e.object.updateMatrixWorld(), b = t.length();
|
|
47
|
-
} else
|
|
48
|
-
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), e.zoomToCursor = !1;
|
|
49
|
-
b !== null && (this.screenSpacePanning ? e.target.set(0, 0, -1).transformDirection(e.object.matrix).multiplyScalar(b).add(e.object.position) : (X.origin.copy(e.object.position), X.direction.set(0, 0, -1).transformDirection(e.object.matrix), Math.abs(e.object.up.dot(X.direction)) < Be ? F.lookAt(e.target) : (Me.setFromNormalAndCoplanarPoint(e.object.up, e.target), X.intersectPlane(Me, e.target))));
|
|
50
|
-
} else if (e.object.isOrthographicCamera) {
|
|
51
|
-
const b = e.object.zoom;
|
|
52
|
-
e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / E)), b !== e.object.zoom && (e.object.updateProjectionMatrix(), z = !0);
|
|
53
|
-
}
|
|
54
|
-
return E = 1, K = !1, z || i.distanceToSquared(e.object.position) > V || 8 * (1 - l.dot(e.object.quaternion)) > V || g.distanceToSquared(e.target) > V ? (e.dispatchEvent(Oe), i.copy(e.object.position), l.copy(e.object.quaternion), g.copy(e.target), !0) : !1;
|
|
55
|
-
};
|
|
56
|
-
}(), this.dispose = function() {
|
|
57
|
-
e.domElement.removeEventListener("contextmenu", be), e.domElement.removeEventListener("pointerdown", de), e.domElement.removeEventListener("pointercancel", Y), e.domElement.removeEventListener("wheel", me), e.domElement.removeEventListener("pointermove", Q), e.domElement.removeEventListener("pointerup", Y), e.domElement.getRootNode().removeEventListener("keydown", pe, { capture: !0 }), e._domElementKeyEvents !== null && (e._domElementKeyEvents.removeEventListener("keydown", v), e._domElementKeyEvents = null);
|
|
58
|
-
};
|
|
59
|
-
const e = this, a = {
|
|
60
|
-
NONE: -1,
|
|
61
|
-
ROTATE: 0,
|
|
62
|
-
DOLLY: 1,
|
|
63
|
-
PAN: 2,
|
|
64
|
-
TOUCH_ROTATE: 3,
|
|
65
|
-
TOUCH_PAN: 4,
|
|
66
|
-
TOUCH_DOLLY_PAN: 5,
|
|
67
|
-
TOUCH_DOLLY_ROTATE: 6
|
|
68
|
-
};
|
|
69
|
-
let r = a.NONE;
|
|
70
|
-
const V = 1e-6, s = new Pe(), p = new Pe();
|
|
71
|
-
let E = 1;
|
|
72
|
-
const j = new u(), P = new m(), T = new m(), A = new m(), O = new m(), w = new m(), L = new m(), D = new m(), R = new m(), M = new m(), $ = new u(), y = new m();
|
|
73
|
-
let K = !1;
|
|
74
|
-
const c = [], I = {};
|
|
75
|
-
let W = !1;
|
|
76
|
-
function Ae(t) {
|
|
77
|
-
return t !== null ? 2 * Math.PI / 60 * e.autoRotateSpeed * t : 2 * Math.PI / 60 / 60 * e.autoRotateSpeed;
|
|
78
|
-
}
|
|
79
|
-
function H(t) {
|
|
80
|
-
const o = Math.abs(t * 0.01);
|
|
81
|
-
return Math.pow(0.95, e.zoomSpeed * o);
|
|
82
|
-
}
|
|
83
|
-
function C(t) {
|
|
84
|
-
p.theta -= t;
|
|
85
|
-
}
|
|
86
|
-
function U(t) {
|
|
87
|
-
p.phi -= t;
|
|
88
|
-
}
|
|
89
|
-
const ee = function() {
|
|
90
|
-
const t = new u();
|
|
91
|
-
return function(n, i) {
|
|
92
|
-
t.setFromMatrixColumn(i, 0), t.multiplyScalar(-n), j.add(t);
|
|
93
|
-
};
|
|
94
|
-
}(), te = function() {
|
|
95
|
-
const t = new u();
|
|
96
|
-
return function(n, i) {
|
|
97
|
-
e.screenSpacePanning === !0 ? t.setFromMatrixColumn(i, 1) : (t.setFromMatrixColumn(i, 0), t.crossVectors(e.object.up, t)), t.multiplyScalar(n), j.add(t);
|
|
98
|
-
};
|
|
99
|
-
}(), x = function() {
|
|
100
|
-
const t = new u();
|
|
101
|
-
return function(n, i) {
|
|
102
|
-
const l = e.domElement;
|
|
103
|
-
if (e.object.isPerspectiveCamera) {
|
|
104
|
-
const g = e.object.position;
|
|
105
|
-
t.copy(g).sub(e.target);
|
|
106
|
-
let d = t.length();
|
|
107
|
-
d *= Math.tan(e.object.fov / 2 * Math.PI / 180), ee(2 * n * d / l.clientHeight, e.object.matrix), te(2 * i * d / l.clientHeight, e.object.matrix);
|
|
108
|
-
} else e.object.isOrthographicCamera ? (ee(n * (e.object.right - e.object.left) / e.object.zoom / l.clientWidth, e.object.matrix), te(i * (e.object.top - e.object.bottom) / e.object.zoom / l.clientHeight, e.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), e.enablePan = !1);
|
|
109
|
-
};
|
|
110
|
-
}();
|
|
111
|
-
function G(t) {
|
|
112
|
-
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? E /= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
113
|
-
}
|
|
114
|
-
function oe(t) {
|
|
115
|
-
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? E *= t : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
116
|
-
}
|
|
117
|
-
function q(t, o) {
|
|
118
|
-
if (!e.zoomToCursor)
|
|
119
|
-
return;
|
|
120
|
-
K = !0;
|
|
121
|
-
const n = e.domElement.getBoundingClientRect(), i = t - n.left, l = o - n.top, g = n.width, d = n.height;
|
|
122
|
-
y.x = i / g * 2 - 1, y.y = -(l / d) * 2 + 1, $.set(y.x, y.y, 1).unproject(e.object).sub(e.object.position).normalize();
|
|
123
|
-
}
|
|
124
|
-
function B(t) {
|
|
125
|
-
return Math.max(e.minDistance, Math.min(e.maxDistance, t));
|
|
126
|
-
}
|
|
127
|
-
function ne(t) {
|
|
128
|
-
P.set(t.clientX, t.clientY);
|
|
129
|
-
}
|
|
130
|
-
function Le(t) {
|
|
131
|
-
q(t.clientX, t.clientX), D.set(t.clientX, t.clientY);
|
|
132
|
-
}
|
|
133
|
-
function ae(t) {
|
|
134
|
-
O.set(t.clientX, t.clientY);
|
|
135
|
-
}
|
|
136
|
-
function De(t) {
|
|
137
|
-
T.set(t.clientX, t.clientY), A.subVectors(T, P).multiplyScalar(e.rotateSpeed);
|
|
138
|
-
const o = e.domElement;
|
|
139
|
-
C(2 * Math.PI * A.x / o.clientHeight), U(2 * Math.PI * A.y / o.clientHeight), P.copy(T), e.update();
|
|
140
|
-
}
|
|
141
|
-
function Re(t) {
|
|
142
|
-
R.set(t.clientX, t.clientY), M.subVectors(R, D), M.y > 0 ? G(H(M.y)) : M.y < 0 && oe(H(M.y)), D.copy(R), e.update();
|
|
143
|
-
}
|
|
144
|
-
function xe(t) {
|
|
145
|
-
w.set(t.clientX, t.clientY), L.subVectors(w, O).multiplyScalar(e.panSpeed), x(L.x, L.y), O.copy(w), e.update();
|
|
146
|
-
}
|
|
147
|
-
function Ne(t) {
|
|
148
|
-
q(t.clientX, t.clientY), t.deltaY < 0 ? oe(H(t.deltaY)) : t.deltaY > 0 && G(H(t.deltaY)), e.update();
|
|
149
|
-
}
|
|
150
|
-
function ke(t) {
|
|
151
|
-
let o = !1;
|
|
152
|
-
switch (t.code) {
|
|
153
|
-
case e.keys.UP:
|
|
154
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? U(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : x(0, e.keyPanSpeed), o = !0;
|
|
155
|
-
break;
|
|
156
|
-
case e.keys.BOTTOM:
|
|
157
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? U(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : x(0, -e.keyPanSpeed), o = !0;
|
|
158
|
-
break;
|
|
159
|
-
case e.keys.LEFT:
|
|
160
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? C(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : x(e.keyPanSpeed, 0), o = !0;
|
|
161
|
-
break;
|
|
162
|
-
case e.keys.RIGHT:
|
|
163
|
-
t.ctrlKey || t.metaKey || t.shiftKey ? C(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : x(-e.keyPanSpeed, 0), o = !0;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
o && (t.preventDefault(), e.update());
|
|
167
|
-
}
|
|
168
|
-
function ie(t) {
|
|
169
|
-
if (c.length === 1)
|
|
170
|
-
P.set(t.pageX, t.pageY);
|
|
171
|
-
else {
|
|
172
|
-
const o = N(t), n = 0.5 * (t.pageX + o.x), i = 0.5 * (t.pageY + o.y);
|
|
173
|
-
P.set(n, i);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
function se(t) {
|
|
177
|
-
if (c.length === 1)
|
|
178
|
-
O.set(t.pageX, t.pageY);
|
|
179
|
-
else {
|
|
180
|
-
const o = N(t), n = 0.5 * (t.pageX + o.x), i = 0.5 * (t.pageY + o.y);
|
|
181
|
-
O.set(n, i);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
function re(t) {
|
|
185
|
-
const o = N(t), n = t.pageX - o.x, i = t.pageY - o.y, l = Math.sqrt(n * n + i * i);
|
|
186
|
-
D.set(0, l);
|
|
187
|
-
}
|
|
188
|
-
function Se(t) {
|
|
189
|
-
e.enableZoom && re(t), e.enablePan && se(t);
|
|
190
|
-
}
|
|
191
|
-
function Ie(t) {
|
|
192
|
-
e.enableZoom && re(t), e.enableRotate && ie(t);
|
|
193
|
-
}
|
|
194
|
-
function ce(t) {
|
|
195
|
-
if (c.length == 1)
|
|
196
|
-
T.set(t.pageX, t.pageY);
|
|
197
|
-
else {
|
|
198
|
-
const n = N(t), i = 0.5 * (t.pageX + n.x), l = 0.5 * (t.pageY + n.y);
|
|
199
|
-
T.set(i, l);
|
|
200
|
-
}
|
|
201
|
-
A.subVectors(T, P).multiplyScalar(e.rotateSpeed);
|
|
202
|
-
const o = e.domElement;
|
|
203
|
-
C(2 * Math.PI * A.x / o.clientHeight), U(2 * Math.PI * A.y / o.clientHeight), P.copy(T);
|
|
204
|
-
}
|
|
205
|
-
function le(t) {
|
|
206
|
-
if (c.length === 1)
|
|
207
|
-
w.set(t.pageX, t.pageY);
|
|
208
|
-
else {
|
|
209
|
-
const o = N(t), n = 0.5 * (t.pageX + o.x), i = 0.5 * (t.pageY + o.y);
|
|
210
|
-
w.set(n, i);
|
|
211
|
-
}
|
|
212
|
-
L.subVectors(w, O).multiplyScalar(e.panSpeed), x(L.x, L.y), O.copy(w);
|
|
213
|
-
}
|
|
214
|
-
function ue(t) {
|
|
215
|
-
const o = N(t), n = t.pageX - o.x, i = t.pageY - o.y, l = Math.sqrt(n * n + i * i);
|
|
216
|
-
R.set(0, l), M.set(0, Math.pow(R.y / D.y, e.zoomSpeed)), G(M.y), D.copy(R);
|
|
217
|
-
const g = (t.pageX + o.x) * 0.5, d = (t.pageY + o.y) * 0.5;
|
|
218
|
-
q(g, d);
|
|
219
|
-
}
|
|
220
|
-
function Ce(t) {
|
|
221
|
-
e.enableZoom && ue(t), e.enablePan && le(t);
|
|
222
|
-
}
|
|
223
|
-
function Ye(t) {
|
|
224
|
-
e.enableZoom && ue(t), e.enableRotate && ce(t);
|
|
225
|
-
}
|
|
226
|
-
function de(t) {
|
|
227
|
-
e.enabled !== !1 && (c.length === 0 && (e.domElement.setPointerCapture(t.pointerId), e.domElement.addEventListener("pointermove", Q), e.domElement.addEventListener("pointerup", Y)), !Xe(t) && (Ue(t), t.pointerType === "touch" ? fe(t) : ze(t)));
|
|
228
|
-
}
|
|
229
|
-
function Q(t) {
|
|
230
|
-
e.enabled !== !1 && (t.pointerType === "touch" ? He(t) : _e(t));
|
|
231
|
-
}
|
|
232
|
-
function Y(t) {
|
|
233
|
-
switch (Ze(t), c.length) {
|
|
234
|
-
case 0:
|
|
235
|
-
e.domElement.releasePointerCapture(t.pointerId), e.domElement.removeEventListener("pointermove", Q), e.domElement.removeEventListener("pointerup", Y), e.dispatchEvent(we), r = a.NONE;
|
|
236
|
-
break;
|
|
237
|
-
case 1:
|
|
238
|
-
const o = c[0], n = I[o];
|
|
239
|
-
fe({ pointerId: o, pageX: n.x, pageY: n.y });
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function ze(t) {
|
|
244
|
-
let o;
|
|
245
|
-
switch (t.button) {
|
|
246
|
-
case 0:
|
|
247
|
-
o = e.mouseButtons.LEFT;
|
|
248
|
-
break;
|
|
249
|
-
case 1:
|
|
250
|
-
o = e.mouseButtons.MIDDLE;
|
|
251
|
-
break;
|
|
252
|
-
case 2:
|
|
253
|
-
o = e.mouseButtons.RIGHT;
|
|
254
|
-
break;
|
|
255
|
-
default:
|
|
256
|
-
o = -1;
|
|
257
|
-
}
|
|
258
|
-
switch (o) {
|
|
259
|
-
case k.DOLLY:
|
|
260
|
-
if (e.enableZoom === !1) return;
|
|
261
|
-
Le(t), r = a.DOLLY;
|
|
262
|
-
break;
|
|
263
|
-
case k.ROTATE:
|
|
264
|
-
if (t.ctrlKey || t.metaKey || t.shiftKey) {
|
|
265
|
-
if (e.enablePan === !1) return;
|
|
266
|
-
ae(t), r = a.PAN;
|
|
267
|
-
} else {
|
|
268
|
-
if (e.enableRotate === !1) return;
|
|
269
|
-
ne(t), r = a.ROTATE;
|
|
270
|
-
}
|
|
271
|
-
break;
|
|
272
|
-
case k.PAN:
|
|
273
|
-
if (t.ctrlKey || t.metaKey || t.shiftKey) {
|
|
274
|
-
if (e.enableRotate === !1) return;
|
|
275
|
-
ne(t), r = a.ROTATE;
|
|
276
|
-
} else {
|
|
277
|
-
if (e.enablePan === !1) return;
|
|
278
|
-
ae(t), r = a.PAN;
|
|
279
|
-
}
|
|
280
|
-
break;
|
|
281
|
-
default:
|
|
282
|
-
r = a.NONE;
|
|
283
|
-
}
|
|
284
|
-
r !== a.NONE && e.dispatchEvent(J);
|
|
285
|
-
}
|
|
286
|
-
function _e(t) {
|
|
287
|
-
switch (r) {
|
|
288
|
-
case a.ROTATE:
|
|
289
|
-
if (e.enableRotate === !1) return;
|
|
290
|
-
De(t);
|
|
291
|
-
break;
|
|
292
|
-
case a.DOLLY:
|
|
293
|
-
if (e.enableZoom === !1) return;
|
|
294
|
-
Re(t);
|
|
295
|
-
break;
|
|
296
|
-
case a.PAN:
|
|
297
|
-
if (e.enablePan === !1) return;
|
|
298
|
-
xe(t);
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
function me(t) {
|
|
303
|
-
e.enabled === !1 || e.enableZoom === !1 || r !== a.NONE || (t.preventDefault(), e.dispatchEvent(J), Ne(Ke(t)), e.dispatchEvent(we));
|
|
304
|
-
}
|
|
305
|
-
function Ke(t) {
|
|
306
|
-
const o = t.deltaMode, n = {
|
|
307
|
-
clientX: t.clientX,
|
|
308
|
-
clientY: t.clientY,
|
|
309
|
-
deltaY: t.deltaY
|
|
310
|
-
};
|
|
311
|
-
switch (o) {
|
|
312
|
-
case 1:
|
|
313
|
-
n.deltaY *= 16;
|
|
314
|
-
break;
|
|
315
|
-
case 2:
|
|
316
|
-
n.deltaY *= 100;
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
return t.ctrlKey && !W && (n.deltaY *= 10), n;
|
|
320
|
-
}
|
|
321
|
-
function pe(t) {
|
|
322
|
-
t.key === "Control" && (W = !0, e.domElement.getRootNode().addEventListener("keyup", he, { passive: !0, capture: !0 }));
|
|
323
|
-
}
|
|
324
|
-
function he(t) {
|
|
325
|
-
t.key === "Control" && (W = !1, e.domElement.getRootNode().removeEventListener("keyup", he, { passive: !0, capture: !0 }));
|
|
326
|
-
}
|
|
327
|
-
function v(t) {
|
|
328
|
-
e.enabled === !1 || e.enablePan === !1 || ke(t);
|
|
329
|
-
}
|
|
330
|
-
function fe(t) {
|
|
331
|
-
switch (ye(t), c.length) {
|
|
332
|
-
case 1:
|
|
333
|
-
switch (e.touches.ONE) {
|
|
334
|
-
case S.ROTATE:
|
|
335
|
-
if (e.enableRotate === !1) return;
|
|
336
|
-
ie(t), r = a.TOUCH_ROTATE;
|
|
337
|
-
break;
|
|
338
|
-
case S.PAN:
|
|
339
|
-
if (e.enablePan === !1) return;
|
|
340
|
-
se(t), r = a.TOUCH_PAN;
|
|
341
|
-
break;
|
|
342
|
-
default:
|
|
343
|
-
r = a.NONE;
|
|
344
|
-
}
|
|
345
|
-
break;
|
|
346
|
-
case 2:
|
|
347
|
-
switch (e.touches.TWO) {
|
|
348
|
-
case S.DOLLY_PAN:
|
|
349
|
-
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
350
|
-
Se(t), r = a.TOUCH_DOLLY_PAN;
|
|
351
|
-
break;
|
|
352
|
-
case S.DOLLY_ROTATE:
|
|
353
|
-
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
354
|
-
Ie(t), r = a.TOUCH_DOLLY_ROTATE;
|
|
355
|
-
break;
|
|
356
|
-
default:
|
|
357
|
-
r = a.NONE;
|
|
358
|
-
}
|
|
359
|
-
break;
|
|
360
|
-
default:
|
|
361
|
-
r = a.NONE;
|
|
362
|
-
}
|
|
363
|
-
r !== a.NONE && e.dispatchEvent(J);
|
|
364
|
-
}
|
|
365
|
-
function He(t) {
|
|
366
|
-
switch (ye(t), r) {
|
|
367
|
-
case a.TOUCH_ROTATE:
|
|
368
|
-
if (e.enableRotate === !1) return;
|
|
369
|
-
ce(t), e.update();
|
|
370
|
-
break;
|
|
371
|
-
case a.TOUCH_PAN:
|
|
372
|
-
if (e.enablePan === !1) return;
|
|
373
|
-
le(t), e.update();
|
|
374
|
-
break;
|
|
375
|
-
case a.TOUCH_DOLLY_PAN:
|
|
376
|
-
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
377
|
-
Ce(t), e.update();
|
|
378
|
-
break;
|
|
379
|
-
case a.TOUCH_DOLLY_ROTATE:
|
|
380
|
-
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
381
|
-
Ye(t), e.update();
|
|
382
|
-
break;
|
|
383
|
-
default:
|
|
384
|
-
r = a.NONE;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
function be(t) {
|
|
388
|
-
e.enabled !== !1 && t.preventDefault();
|
|
389
|
-
}
|
|
390
|
-
function Ue(t) {
|
|
391
|
-
c.push(t.pointerId);
|
|
392
|
-
}
|
|
393
|
-
function Ze(t) {
|
|
394
|
-
delete I[t.pointerId];
|
|
395
|
-
for (let o = 0; o < c.length; o++)
|
|
396
|
-
if (c[o] == t.pointerId) {
|
|
397
|
-
c.splice(o, 1);
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
function Xe(t) {
|
|
402
|
-
for (let o = 0; o < c.length; o++)
|
|
403
|
-
if (c[o] == t.pointerId) return !0;
|
|
404
|
-
return !1;
|
|
405
|
-
}
|
|
406
|
-
function ye(t) {
|
|
407
|
-
let o = I[t.pointerId];
|
|
408
|
-
o === void 0 && (o = new m(), I[t.pointerId] = o), o.set(t.pageX, t.pageY);
|
|
409
|
-
}
|
|
410
|
-
function N(t) {
|
|
411
|
-
const o = t.pointerId === c[0] ? c[1] : c[0];
|
|
412
|
-
return I[o];
|
|
413
|
-
}
|
|
414
|
-
e.domElement.addEventListener("contextmenu", be), e.domElement.addEventListener("pointerdown", de), e.domElement.addEventListener("pointercancel", Y), e.domElement.addEventListener("wheel", me, { passive: !1 }), e.domElement.getRootNode().addEventListener("keydown", pe, { passive: !0, capture: !0 }), this.update();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
export {
|
|
418
|
-
et as O
|
|
419
|
-
};
|