ss-component-new 1.1.538 → 1.1.539
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/{index-DO-3WtGu.cjs → index-BKlPw_jN.cjs} +1 -1
- package/dist/{index-DrJsWY8J.js → index-CVX3TWb8.js} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +1 -1
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +1 -1
- package/dist/{threeModel-Cqcd50BC.cjs → threeModel-D8lqCKTF.cjs} +1 -1
- package/dist/{threeModel-cIvl3jxi.js → threeModel-aG5qpZ_h.js} +93 -94
- package/package.json +1 -1
package/dist/ss-component.js
CHANGED
|
@@ -31,7 +31,7 @@ const i = s(() => import("./index-Dp8nYzYT.js"));
|
|
|
31
31
|
i.install = (o) => {
|
|
32
32
|
o.component("ssAvatar", i);
|
|
33
33
|
};
|
|
34
|
-
const l = s(() => import("./threeModel-
|
|
34
|
+
const l = s(() => import("./threeModel-aG5qpZ_h.js"));
|
|
35
35
|
l.install = (o) => {
|
|
36
36
|
o.component("ssThree", l);
|
|
37
37
|
};
|
package/dist/ss-component2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("vue-router"),t=[{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-i6oSAK8p.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-
|
|
1
|
+
"use strict";const o=require("vue-router"),t=[{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-i6oSAK8p.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-BKlPw_jN.cjs")),children:[{path:"平台管理/菜单管理",name:"Menu",component:async()=>Promise.resolve().then(()=>require("./index-CF0HELy8.cjs"))},{path:"平台管理/主菜单管理",name:"MainMenu",component:async()=>Promise.resolve().then(()=>require("./index-DHuUMPnc.cjs"))},{path:"系统管理/个人中心",name:"PersonalCenter",component:async()=>Promise.resolve().then(()=>require("./index-DSGsFq9G.cjs"))},{path:"系统管理/职位管理",name:"Post",component:async()=>Promise.resolve().then(()=>require("./index-hPQ6sEZh.cjs"))},{path:"系统管理/用户管理",name:"User",component:async()=>Promise.resolve().then(()=>require("./index-DtWH6Vvi.cjs"))},{path:"系统管理/角色管理",name:"Role",component:async()=>Promise.resolve().then(()=>require("./index-ttUumQ5Q.cjs"))},{path:"系统管理/部门管理",name:"Dept",component:async()=>Promise.resolve().then(()=>require("./index-D0RGZjrn.cjs"))},{path:"priority",name:"Priority",component:async()=>Promise.resolve().then(()=>require("./index-D0QjuJev.cjs"))}]}],n=o.createRouter({history:o.createWebHashHistory(),routes:t});n.beforeEach((r,s,e)=>{!sessionStorage.getItem("loginToken")&&r.path!=="/login"?e("/login"):e()});module.exports=n;
|
package/dist/ss-component2.js
CHANGED
|
@@ -8,7 +8,7 @@ const a = [
|
|
|
8
8
|
{
|
|
9
9
|
path: "/",
|
|
10
10
|
name: "Model",
|
|
11
|
-
component: async () => import("./index-
|
|
11
|
+
component: async () => import("./index-CVX3TWb8.js"),
|
|
12
12
|
// component: async ()=>import('@/components/views/model/component/main.vue'),
|
|
13
13
|
// component: async ()=>import('@/components/views/canvas/index.vue'),
|
|
14
14
|
// component: async ()=>import('@/components/views/test/index.vue'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),i=require("./threeModel.vue_vue_type_style_index_0_scoped_fa07a7ad_lang-DCn4bomb.cjs"),W=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ae={type:"change"},oe={type:"start"},re={type:"end"},q=new i.Ray,le=new i.Plane,me=Math.cos(70*i.MathUtils.DEG2RAD),z=new i.Vector3,F=2*Math.PI,x={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ee=1e-6;class fe extends i.Controls{constructor(t,o=null){super(t,o),this.state=x.NONE,this.target=new i.Vector3,this.cursor=new i.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.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:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new i.Vector3,this._lastQuaternion=new i.Quaternion,this._lastTargetPosition=new i.Vector3,this._quat=new i.Quaternion().setFromUnitVectors(t.up,new i.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new i.Spherical,this._sphericalDelta=new i.Spherical,this._scale=1,this._panOffset=new i.Vector3,this._rotateStart=new i.Vector2,this._rotateEnd=new i.Vector2,this._rotateDelta=new i.Vector2,this._panStart=new i.Vector2,this._panEnd=new i.Vector2,this._panDelta=new i.Vector2,this._dollyStart=new i.Vector2,this._dollyEnd=new i.Vector2,this._dollyDelta=new i.Vector2,this._dollyDirection=new i.Vector3,this._mouse=new i.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=ge.bind(this),this._onPointerDown=_e.bind(this),this._onPointerUp=ye.bind(this),this._onContextMenu=xe.bind(this),this._onMouseWheel=Ee.bind(this),this._onKeyDown=we.bind(this),this._onTouchStart=Pe.bind(this),this._onTouchMove=Me.bind(this),this._onMouseDown=ve.bind(this),this._onMouseMove=be.bind(this),this._interceptControlDown=De.bind(this),this._interceptControlUp=Se.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(t){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"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(ae),this.update(),this.state=x.NONE}update(t=null){const o=this.object.position;z.copy(o).sub(this.target),z.applyQuaternion(this._quat),this._spherical.setFromVector3(z),this.autoRotate&&this.state===x.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);let n=this.minAzimuthAngle,l=this.maxAzimuthAngle;isFinite(n)&&isFinite(l)&&(n<-Math.PI?n+=F:n>Math.PI&&(n-=F),l<-Math.PI?l+=F:l>Math.PI&&(l-=F),n<=l?this._spherical.theta=Math.max(n,Math.min(l,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+l)/2?Math.max(n,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);let p=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const g=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),p=g!=this._spherical.radius}if(z.setFromSpherical(this._spherical),z.applyQuaternion(this._quatInverse),o.copy(this.target).add(z),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){let g=null;if(this.object.isPerspectiveCamera){const r=z.length();g=this._clampDistance(r*this._scale);const w=r-g;this.object.position.addScaledVector(this._dollyDirection,w),this.object.updateMatrixWorld(),p=!!w}else if(this.object.isOrthographicCamera){const r=new i.Vector3(this._mouse.x,this._mouse.y,0);r.unproject(this.object);const w=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),p=w!==this.object.zoom;const P=new i.Vector3(this._mouse.x,this._mouse.y,0);P.unproject(this.object),this.object.position.sub(P).add(r),this.object.updateMatrixWorld(),g=z.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;g!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(g).add(this.object.position):(q.origin.copy(this.object.position),q.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(q.direction))<me?this.object.lookAt(this.target):(le.setFromNormalAndCoplanarPoint(this.object.up,this.target),q.intersectPlane(le,this.target))))}else if(this.object.isOrthographicCamera){const g=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),g!==this.object.zoom&&(this.object.updateProjectionMatrix(),p=!0)}return this._scale=1,this._performCursorZoom=!1,p||this._lastPosition.distanceToSquared(this.object.position)>ee||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ee||this._lastTargetPosition.distanceToSquared(this.target)>ee?(this.dispatchEvent(ae),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?F/60*this.autoRotateSpeed*t:F/60/60*this.autoRotateSpeed}_getZoomScale(t){const o=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*o)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,o){z.setFromMatrixColumn(o,0),z.multiplyScalar(-t),this._panOffset.add(z)}_panUp(t,o){this.screenSpacePanning===!0?z.setFromMatrixColumn(o,1):(z.setFromMatrixColumn(o,0),z.crossVectors(this.object.up,z)),z.multiplyScalar(t),this._panOffset.add(z)}_pan(t,o){const n=this.domElement;if(this.object.isPerspectiveCamera){const l=this.object.position;z.copy(l).sub(this.target);let p=z.length();p*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*p/n.clientHeight,this.object.matrix),this._panUp(2*o*p/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(o*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,o){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),l=t-n.left,p=o-n.top,g=n.width,r=n.height;this._mouse.x=l/g*2-1,this._mouse.y=-(p/r)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const o=this.domElement;this._rotateLeft(F*this._rotateDelta.x/o.clientHeight),this._rotateUp(F*this._rotateDelta.y/o.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){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()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let o=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),o=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),o=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),o=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),o=!0;break}o&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),n=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._rotateStart.set(n,l)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),n=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panStart.set(n,l)}}_handleTouchStartDolly(t){const o=this._getSecondPointerPosition(t),n=t.pageX-o.x,l=t.pageY-o.y,p=Math.sqrt(n*n+l*l);this._dollyStart.set(0,p)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),l=.5*(t.pageX+n.x),p=.5*(t.pageY+n.y);this._rotateEnd.set(l,p)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const o=this.domElement;this._rotateLeft(F*this._rotateDelta.x/o.clientHeight),this._rotateUp(F*this._rotateDelta.y/o.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),n=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panEnd.set(n,l)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const o=this._getSecondPointerPosition(t),n=t.pageX-o.x,l=t.pageY-o.y,p=Math.sqrt(n*n+l*l);this._dollyEnd.set(0,p),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const g=(t.pageX+o.x)*.5,r=(t.pageY+o.y)*.5;this._updateZoomParameters(g,r)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let o=0;o<this._pointers.length;o++)if(this._pointers[o]==t.pointerId){this._pointers.splice(o,1);return}}_isTrackingPointer(t){for(let o=0;o<this._pointers.length;o++)if(this._pointers[o]==t.pointerId)return!0;return!1}_trackPointer(t){let o=this._pointerPositions[t.pointerId];o===void 0&&(o=new i.Vector2,this._pointerPositions[t.pointerId]=o),o.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const o=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[o]}_customWheelEvent(t){const o=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(o){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function _e(a){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(a.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(a)&&(this._addPointer(a),a.pointerType==="touch"?this._onTouchStart(a):this._onMouseDown(a)))}function ge(a){this.enabled!==!1&&(a.pointerType==="touch"?this._onTouchMove(a):this._onMouseMove(a))}function ye(a){switch(this._removePointer(a),this._pointers.length){case 0:this.domElement.releasePointerCapture(a.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(re),this.state=x.NONE;break;case 1:const t=this._pointers[0],o=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:o.x,pageY:o.y});break}}function ve(a){let t;switch(a.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(a),this.state=x.DOLLY;break;case i.MOUSE.ROTATE:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=x.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=x.ROTATE}break;case i.MOUSE.PAN:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=x.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=x.PAN}break;default:this.state=x.NONE}this.state!==x.NONE&&this.dispatchEvent(oe)}function be(a){switch(this.state){case x.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(a);break;case x.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(a);break;case x.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(a);break}}function Ee(a){this.enabled===!1||this.enableZoom===!1||this.state!==x.NONE||(a.preventDefault(),this.dispatchEvent(oe),this._handleMouseWheel(this._customWheelEvent(a)),this.dispatchEvent(re))}function we(a){this.enabled!==!1&&this._handleKeyDown(a)}function Pe(a){switch(this._trackPointer(a),this._pointers.length){case 1:switch(this.touches.ONE){case i.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(a),this.state=x.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(a),this.state=x.TOUCH_PAN;break;default:this.state=x.NONE}break;case 2:switch(this.touches.TWO){case i.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(a),this.state=x.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(a),this.state=x.TOUCH_DOLLY_ROTATE;break;default:this.state=x.NONE}break;default:this.state=x.NONE}this.state!==x.NONE&&this.dispatchEvent(oe)}function Me(a){switch(this._trackPointer(a),this.state){case x.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(a),this.update();break;case x.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(a),this.update();break;case x.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(a),this.update();break;case x.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(a),this.update();break;default:this.state=x.NONE}}function xe(a){this.enabled!==!1&&a.preventDefault()}function De(a){a.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Se(a){a.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Ce(a){let t=null,o=null,n=null,l=null,p=null,g=null,r=null,w=null;const P=e.ref([]),D=e.ref(new i.Vector3),L=e.ref(new i.Vector3),V=()=>{if(!a.value)return;t=new i.Scene,t.background=new i.Color(15790320);const f=a.value;o=new i.PerspectiveCamera(75,f.clientWidth/f.clientHeight,.1,1e4),o.position.set(8,-8,6),o.up.set(0,0,1),o.lookAt(0,0,0),n=new i.WebGLRenderer({antialias:!0,alpha:!0}),n.setSize(f.clientWidth,f.clientHeight),n.localClippingEnabled=!0,n.shadowMap.enabled=!0,n.shadowMap.type=i.PCFSoftShadowMap,n.toneMapping=i.ACESFilmicToneMapping,n.toneMappingExposure=1,n.outputColorSpace=i.SRGBColorSpace,f.appendChild(n.domElement),l=new fe(o,n.domElement),l.enableDamping=!0,l.dampingFactor=.05,l.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.PAN,RIGHT:null},l.panSpeed=.7,p=new i.Xe(o,n,{container:f,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),p.attachControls(l),y(),s()},u=(f,c)=>{r&&(t.remove(r),r.dispose()),w&&(t.remove(w),w.geometry.dispose(),w.material.dispose());const M=Math.min(Math.max(Math.floor(f/20),30),40);r=new i.GridHelper(f,M,13421772,14540253),r.rotateX(Math.PI/2),r.position.copy(c),t.add(r);const U=new i.PlaneGeometry(f,f),h=new i.ShadowMaterial({opacity:.3,color:0});w=new i.Mesh(U,h),w.position.copy(c),w.position.z-=.01,w.receiveShadow=!0,t.add(w)},S=()=>{if(P.value.length===0)return;const f=new i.Box3;P.value.forEach(d=>{f.expandByObject(d)});const c=f.getSize(new i.Vector3),M=f.getCenter(new i.Vector3),U=Math.max(c.x,c.y,c.z),h=Math.max(U*8,50),v=new i.Vector3(M.x,M.y,f.min.z);u(h,v)},y=()=>{const f=new i.AmbientLight(4210752,.6);t.add(f);const c=new i.DirectionalLight(16777215,2);c.position.set(10,10,8),c.castShadow=!0,c.shadow.mapSize.width=4096,c.shadow.mapSize.height=4096,c.shadow.camera.near=.5,c.shadow.camera.far=50,c.shadow.camera.left=-50,c.shadow.camera.right=50,c.shadow.camera.top=50,c.shadow.camera.bottom=-50,t.add(c);const M=new i.DirectionalLight(16777215,.8);M.position.set(-8,-8,6),t.add(M);const U=new i.DirectionalLight(16777215,.6);U.position.set(0,-15,2),t.add(U);const h=new i.HemisphereLight(16777215,4473924,.8);t.add(h);const v=new i.PointLight(16777215,1,50);v.position.set(15,15,15),t.add(v);const d=new i.PointLight(16777215,.5,50);d.position.set(-15,-15,15),t.add(d)},s=()=>{g=requestAnimationFrame(s),l&&l.update(),n&&t&&o&&n.render(t,o),p&&p.render()},m=f=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(M=>{f[M]&&f[M].dispose&&f[M].dispose()}),f.dispose&&f.dispose()},E=f=>{f==null||f.traverse(c=>{c.geometry&&c.geometry.dispose(),c.material&&(Array.isArray(c.material)?c.material.forEach(M=>{m(M)}):m(c.material))})};return{currentModels:P,initialCameraPosition:D,initialTargetPosition:L,initThreeJS:V,handleResize:()=>{if(!a.value||!o||!n||!p)return;const f=a.value,c=f.clientWidth,M=f.clientHeight;o.aspect=c/M,o.updateProjectionMatrix(),n.setSize(c,M),p.update()},fitCameraToAllModels:()=>{if(!o||!l||P.value.length===0)return;const f=new i.Box3;P.value.forEach(d=>{f.expandByObject(d)});const c=f.getSize(new i.Vector3),M=f.getCenter(new i.Vector3),h=Math.max(c.x,c.y,c.z)*.8,v=new i.Vector3(M.x+h,M.y-h,M.z+h);o.position.copy(v),o.lookAt(M),l.target.copy(M),l.update(),D.value.copy(v),L.value.copy(M),S()},getThreeJSObjects:()=>({scene:t,camera:o,renderer:n,controls:l,gizmo:p}),clearAllModels:()=>{if(!t)return;P.value.forEach(c=>{t.remove(c),E(c)});const f=[];t.children.forEach(c=>{!c.isLight&&!c.isCamera&&c.type!=="GridHelper"&&c!==w&&f.push(c)}),f.forEach(c=>{t.remove(c),E(c)}),P.value=[],S()},cleanup:()=>{g&&cancelAnimationFrame(g),r&&r.dispose(),w&&(w.geometry.dispose(),w.material.dispose()),n&&n.dispose(),l&&l.dispose(),p&&p.dispose()},updateGridForModels:S}}function Ve(a,t){const o=e.ref(!1);let n=null,l=12700,p=new i.Vector3,g=new i.Vector3,r=new i.Vector3,w=0,P=null;const D=s=>s<.5?4*s*s*s:1-Math.pow(-2*s+2,3)/2,L=s=>{const m=new i.Vector3,E=w*1.2,T=new i.Vector3(r.x+E,r.y,r.z),j=new i.Vector3(r.x,r.y+E,r.z),R=new i.Vector3(r.x,r.y-E,r.z);if(s<=.567){const I=s/.567*Math.PI*2;m.x=r.x+Math.cos(I)*E,m.z=r.z+Math.sin(I)*E,m.y=r.y}else if(s<=.724){const N=(s-.567)/.157,I=D(N);m.lerpVectors(T,j,I)}else if(s<=.881){const N=(s-.724)/.157,f=D(N)*Math.PI;m.x=r.x+Math.sin(f)*E,m.y=r.y+Math.cos(f)*E,m.z=r.z}else{const N=(s-.881)/.119,I=D(N);m.lerpVectors(R,p,I)}return m},V=()=>{const{camera:s,controls:m}=a();if(!s||!m)return;n||(n=Date.now());const E=Date.now()-n,T=Math.min(E/l,1);if(T>=1){S();return}const j=L(T);s.position.copy(j),s.lookAt(r),m.target.copy(r),P=requestAnimationFrame(V)},u=()=>{if(t.value.length===0)return;const{camera:s,controls:m}=a();if(!s||!m)return;p.copy(s.position),g.copy(m.target);const E=new i.Box3;t.value.forEach(c=>{E.expandByObject(c)});const T=E.getSize(new i.Vector3);r=E.getCenter(new i.Vector3),w=Math.max(T.x,T.y,T.z)*1.2;const j=new i.Vector3(r.x+w*1.2,r.y,r.z);m.enabled=!1;const R=s.position.clone(),N=1e3,I=Date.now(),f=()=>{const c=Date.now()-I,M=Math.min(c/N,1),U=D(M);s.position.lerpVectors(R,j,U),s.lookAt(r),m.target.copy(r),M<1?requestAnimationFrame(f):(o.value=!0,n=null,V())};f()},S=()=>{o.value=!1,n=null,P&&(cancelAnimationFrame(P),P=null);const{controls:s}=a();s&&(s.enabled=!0,s.target.copy(g))};return{isAnimating:o,toggleAnimation:()=>{if(o.value){o.value=!1,n=null,P&&(cancelAnimationFrame(P),P=null);const{camera:s,controls:m}=a();if(!s||!m)return;m.enabled=!0;const E=s.position.clone(),T=m.target.clone(),j=1500,R=Date.now(),N=()=>{const I=Date.now()-R,f=Math.min(I/j,1),c=D(f);s.position.lerpVectors(E,p,c),m.target.lerpVectors(T,g,c),f<1&&requestAnimationFrame(N)};N()}else u()},startAnimation:u,stopAnimation:S}}function ke(a,t){const o=e.ref(!1),n=e.ref("none");let l=[],p=[],g=new i.Box3,r=new i.Vector3;const w=()=>{l=[new i.Plane(new i.Vector3(1,0,0),0),new i.Plane(new i.Vector3(0,1,0),0),new i.Plane(new i.Vector3(0,0,1),0)]},P=()=>{g.makeEmpty(),t.value.forEach(y=>{g.expandByObject(y)}),r=g.getCenter(new i.Vector3)},D=y=>{const s=g.getSize(new i.Vector3);let m,E,T;y==="x"?(m=new i.PlaneGeometry(s.z*1.2,s.y*1.2),E=new i.Vector3(r.x,r.y,r.z),T=new i.Euler(0,Math.PI/2,0)):y==="y"?(m=new i.PlaneGeometry(s.x*1.2,s.z*1.2),E=new i.Vector3(r.x,r.y,r.z),T=new i.Euler(Math.PI/2,0,0)):y==="z"&&(m=new i.PlaneGeometry(s.x*1.2,s.y*1.2),E=new i.Vector3(r.x,r.y,r.z),T=new i.Euler(0,0,0));const j=new i.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:i.DoubleSide,depthWrite:!1}),R=new i.Mesh(m,j);return R.position.copy(E),R.rotation.copy(T),R},L=()=>{if(V(),u(),n.value==="none")return;P();let y=null;if(n.value==="x"?(l[0].constant=-r.x,y=l[0]):n.value==="y"?(l[1].constant=-r.y,y=l[1]):n.value==="z"&&(l[2].constant=-r.z,y=l[2]),y){t.value.forEach(m=>{m.traverse(E=>{E.isMesh&&E.material&&(Array.isArray(E.material)?E.material.forEach(T=>{T.clippingPlanes=[y]}):E.material.clippingPlanes=[y])})});const{scene:s}=a();if(s){const m=D(n.value);s.add(m),p.push(m)}}},V=()=>{t.value.forEach(y=>{y.traverse(s=>{s.isMesh&&s.material&&(Array.isArray(s.material)?s.material.forEach(m=>{m.clippingPlanes=[]}):s.material.clippingPlanes=[])})})},u=()=>{const{scene:y}=a();y&&p.forEach(s=>{y.remove(s),s.geometry.dispose(),s.material.dispose()}),p=[]};return{isClipping:o,activeClippingAxis:n,toggleClipping:()=>{o.value=!o.value,o.value?(w(),t.value.length>0&&P()):(n.value="none",V(),u())},updateClippingPlanes:L,clearClippingPlanes:V,clearClippingMeshes:u}}const Te={class:"panel-content"},Ae="id",Ne={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:a=>["breadth","firstLevel"].includes(a)}},emits:["nodeClick"],setup(a,{emit:t}){const o=a,n=t,l=e.ref([]),p={children:"children",label:"label"},g=u=>{n("nodeClick",u)},r=(u,S=0)=>{const y=[];return Array.isArray(u)&&(u==null?void 0:u.length)>0&&u.forEach(s=>{if(!(s!=null&&s.isMesh)&&((s==null?void 0:s.type)==="URDFJoint"||(s==null?void 0:s.type)==="URDFLink")){const m={name:s==null?void 0:s.name,label:s==null?void 0:s.name,show:!0,level:S+1,isPenultimate:!1,type:s==null?void 0:s.type,id:s==null?void 0:s.id,limit:(s==null?void 0:s.limit)??"",children:r(s==null?void 0:s.children,S+1),path:s==null?void 0:s.name};y.push(m)}}),y},w=u=>u?[{name:u==null?void 0:u.name,label:u==null?void 0:u.name,show:!0,level:1,isPenultimate:!1,type:u==null?void 0:u.type,id:u==null?void 0:u.id,limit:(u==null?void 0:u.limit)??"",children:r(u==null?void 0:u.children,1),path:u==null?void 0:u.name}]:[],P=(u,S)=>{const y=[],s=[...u];for(;s.length>0&&y.length<S;){const m=s.shift();m.children&&m.children.length>0&&(y.push(m.id),s.push(...m.children))}return y},D=(u,S)=>{const y=[];return u.forEach(s=>{if(s.children&&s.children.length>0){y.push(s.id);const m=s.children.filter(E=>E.children&&E.children.length>0).slice(0,S).map(E=>E.id);y.push(...m)}}),y.slice(0,S+1)},L=e.computed(()=>!l.value||l.value.length===0?[]:o.expandStrategy==="firstLevel"?D(l.value,o.maxExpandCount):P(l.value,o.maxExpandCount)),V=e.computed(()=>o!=null&&o.model?w(o.model):[]);return e.watch(V,u=>{l.value=JSON.parse(JSON.stringify(u))},{immediate:!0}),(u,S)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(y,{data:l.value,props:p,"default-expanded-keys":L.value,"node-key":Ae,onNodeClick:g},null,8,["data","default-expanded-keys"])])}}},ze=W._export_sfc(Ne,[["__scopeId","data-v-290ff4e1"]]),Oe={class:"panel-content"},Re={key:0,class:"joints-list"},Le={class:"joint-info-row"},je={class:"joint-left"},Ie={class:"joint-name"},Ue={class:"joint-range"},Fe={class:"joint-type"},Be={key:0,class:"joint-control-row"},Ye={class:"slider-container"},He=["min","max","value","onInput","disabled"],Ke={class:"value-display"},Ze={class:"joint-value"},$e={class:"unit"},Xe={key:1,class:"empty-state"},Ge=1e3,te=60,Je={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Array},setup(a,{expose:t}){const o=a;e.ref(!0);const n=e.ref([]),l=e.ref(null),p=e.ref(!1),g=e.ref(!1),r=e.ref(0),w=e.ref(0),P=e.ref(null),D=e.ref(1),L=()=>Ge/te/D.value;let V=[];e.watch(()=>o.animationData,h=>{h&&h.length>0&&(V=h,T())},{deep:!0});const u=(h,v=!1)=>h==="revolute"?v?Math.PI:-Math.PI:h==="prismatic"?v?1:-1:0,S=h=>{if(!h||!h.joints)return console.warn("URDF模型没有关节信息"),[];const v=[];return Object.keys(h.joints).forEach(d=>{console.log(232,h.joints,d);const b=h.joints[d];if(b._jointType==="fixed")return;const O=b.limit?{lower:b.limit.lower??u(b._jointType,!1),upper:b.limit.upper??u(b._jointType,!0)}:{lower:u(b._jointType,!1),upper:u(b._jointType,!0)};v.push({name:d.toUpperCase(),type:b._jointType||"unknown",limit:O,currentValue:b.angle||0,urdfJoint:b})}),v.sort((d,b)=>d.name.localeCompare(b.name))},y=(h,v)=>{const d=n.value.find(O=>O.name.toUpperCase()===h.toUpperCase());if(!d)return;const b=parseFloat(v);if(d.limit){const O=Math.max(d.limit.lower,Math.min(d.limit.upper,b));d.currentValue=O}else d.currentValue=b;o.model&&o.model.setJointValue?o.model.setJointValue(h.toUpperCase(),d.currentValue):d.urdfJoint&&d.urdfJoint.setJointValue(d.currentValue)},s=h=>{h&&Object.keys(h).forEach(v=>{const d=h[v],b=n.value.find(O=>O.name.toUpperCase()===v.toUpperCase());b&&(b.currentValue=d,o.model&&o.model.setJointValue?o.model.setJointValue(v,d):b.urdfJoint&&b.urdfJoint.setJointValue(d))})},m=(h,v,d)=>h+(v-h)*d,E=(h,v,d)=>{if(!h||!v)return h||v;const b={};return Object.keys(h).forEach(O=>{const Y=h[O],H=v[O];b[O]=m(Y,H||Y,d)}),b},T=()=>{if(V.length===0){console.warn("没有动画数据");return}p.value=!0,g.value=!1;const h=()=>{if(!p.value||g.value)return;const v=w.value/te,d=V[r.value],b=V[r.value+1];if(b){const O=E(d,b,v);s(O)}else s(d);if(w.value++,w.value>=te&&(w.value=0,r.value++,r.value>=V.length-1)){R();return}P.value=setTimeout(h,L())};h()},j=()=>{g.value=!0,P.value&&(clearTimeout(P.value),P.value=null)},R=()=>{p.value=!1,g.value=!1,D.value=1,P.value&&(clearTimeout(P.value),P.value=null)};t({startAnimation:T,pauseAnimation:j,stopAnimation:R,resetAll:()=>{R(),r.value=0,w.value=0,n.value.forEach(h=>{(h.type==="revolute"||h.type==="prismatic")&&y(h.name,0)})},fastForward:()=>{D.value<4&&(D.value=Math.min(4,D.value*2))},fastBackward:()=>{D.value>.25&&(D.value=Math.max(.25,D.value/2))}}),e.watch(()=>o.model,h=>{h?n.value=S(h):n.value=[]},{immediate:!0});const c=()=>{!o.model||p.value&&!g.value||n.value.forEach(h=>{h.urdfJoint&&h.urdfJoint.angle!==void 0&&(h.currentValue=h.urdfJoint.angle)})},M=()=>{const h=()=>{c(),l.value=requestAnimationFrame(h)};h()},U=()=>{l.value&&(cancelAnimationFrame(l.value),l.value=null)};return e.onMounted(()=>{M()}),e.onUnmounted(()=>{U(),R()}),(h,v)=>(e.openBlock(),e.createElementBlock("div",Oe,[n.value.length>0?(e.openBlock(),e.createElementBlock("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,d=>{var b,O,Y,H;return e.openBlock(),e.createElementBlock("div",{key:d.name,class:"joint-item"},[e.createElementVNode("div",Le,[e.createElementVNode("div",je,[e.createElementVNode("span",Ie,e.toDisplayString(d.name),1),e.createElementVNode("span",Ue," ["+e.toDisplayString(((b=d.limit)==null?void 0:b.lower.toFixed(2))??(d.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((O=d.limit)==null?void 0:O.upper.toFixed(2))??(d.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",Fe,e.toDisplayString(d.type),1)]),d.type==="revolute"||d.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Ye,[e.createElementVNode("input",{type:"range",min:((Y=d.limit)==null?void 0:Y.lower)??(d.type==="revolute"?-Math.PI:-1),max:((H=d.limit)==null?void 0:H.upper)??(d.type==="revolute"?Math.PI:1),step:.01,value:d.currentValue,onInput:Q=>y(d.name,Q.target.value),class:"joint-slider",disabled:p.value&&!g.value},null,40,He)]),e.createElementVNode("div",Ke,[e.createElementVNode("span",Ze,e.toDisplayString(d.currentValue.toFixed(3)),1),e.createElementVNode("span",$e,e.toDisplayString(d.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Xe,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},qe=W._export_sfc(Je,[["__scopeId","data-v-6ec0bcfa"]]),We=["xlink:href"],Qe=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(a){const t=a,o=e.computed(()=>({backgroundColor:t.backgroundColor})),n=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>{const{size:p}=t;let g=`${p}`;return g=`${g.replace("px","")}px`,{width:g,height:g}});return(p,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:p.active}]),style:e.normalizeStyle(o.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[p.$attrs.class,p.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(l.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":n.value},null,8,We)],6))],6))}}),k=W._export_sfc(Qe,[["__scopeId","data-v-3150a90b"]]),et={class:"obj-viewer-container"},tt={class:"buttonGroup-top"},ot={class:"buttonGroup-topLeft"},it={class:"buttonGroup-left"},st={class:"buttonGroup-right"},nt={class:"buttonGroup-bottom"},at={class:"left-panel"},lt={class:"panel-header"},rt={key:1,class:"clipping-content"},ct={class:"radio-group"},ht={class:"radio-label"},ut={class:"radio-label"},dt={class:"radio-label"},pt={class:"radio-label"},mt={class:"right-panel"},ft={class:"panel-header"},_t={key:0,class:"loading-overlay"},gt={__name:"threeModel",props:{animationData:{type:Array,default:[]}},emits:["getAnimationData"],setup(a,{expose:t,emit:o}){const n=o,l=a;let p=null,g=!1;const r=e.ref(null),w=e.ref(!1),P=e.ref("");e.ref(!1);const D=e.ref(!1),L=e.ref(!1),V=e.ref(""),u=e.ref(!1),S=e.ref(""),y=e.ref(),{currentModels:s,initialCameraPosition:m,initialTargetPosition:E,initThreeJS:T,handleResize:j,fitCameraToAllModels:R,getThreeJSObjects:N,clearAllModels:I,cleanup:f}=Ce(r),{isAnimating:c,toggleAnimation:M,stopAnimation:U}=Ve(N,s),{isClipping:h,activeClippingAxis:v,toggleClipping:d,updateClippingPlanes:b}=ke(N,s),{addModelsFromUrls:O,loadModelByDefaultPath:Y,urdfModel:H}=i.useModelLoader(N,s,w,P,I),Q=()=>{if(D.value||s.value.length===0)return;D.value=!0,c.value&&U();const{camera:A,controls:_}=N();if(!A||!_)return;_.enabled=!0;const B=K=>K<.5?4*K*K*K:1-Math.pow(-2*K+2,3)/2,$=A.position.clone(),X=_.target.clone(),G=1500,J=Date.now(),C=()=>{const K=Date.now()-J,se=Math.min(K/G,1),ne=B(se);A.position.lerpVectors($,m.value,ne),_.target.lerpVectors(X,E.value,ne),se<1?requestAnimationFrame(C):D.value=!1};C()},ce=async()=>g?Promise.resolve():new Promise(A=>{const _=()=>{g?A():requestAnimationFrame(_)};_()}),ie=async(A,_)=>{try{await ce(),c.value&&U(),h.value&&d();const B=await _(A);return R(),B}catch(B){throw console.error("加载模型失败:",B),B}},he=async A=>ie(A,O),ue=async A=>ie(A,Y),Z=A=>{L.value=!0,V.value=A,A==="剖面视图"&&!h.value&&d()},de=A=>{u.value=!0,S.value=A},pe=()=>{n("getAnimationData"),e.nextTick(()=>{var A;(A=y.value)==null||A.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{T(),p=N().scene,g=!0,window.addEventListener("resize",j)}catch(A){console.error("Three.js初始化失败:",A)}}),e.onBeforeUnmount(()=>{g=!1,V.value="",S.value="",window.removeEventListener("resize",j),c.value&&U(),f()}),t({addModelsFromUrls:he,loadModelByDefaultPath:ue}),(A,_)=>{var $,X,G,J;const B=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",et,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",tt,[e.createVNode(k,{name:"guanjianjiexi",size:"34"}),e.createVNode(k,{name:"guanjiekongzhi",size:"34"}),e.createVNode(k,{name:"gongyishengcheng",size:"34"}),e.createVNode(k,{name:"buchangshezhi",size:"34"}),e.createVNode(k,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",ot,[e.createVNode(k,{name:"viewReset",size:"24",onClick:Q,title:"重置"}),e.createVNode(k,{name:"fangda",size:"24",title:"放大"}),e.createVNode(k,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(k,{name:"lookAround",size:"24",onClick:e.unref(M),title:e.unref(c)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",it,[e.createVNode(k,{name:"jiegoushu",size:"24",onClick:_[0]||(_[0]=C=>Z("场景树")),active:L.value&&V.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(k,{name:"clipping",size:"24",onClick:_[1]||(_[1]=C=>Z("剖面视图")),active:L.value&&V.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(k,{name:"donghuafangzhen",size:"24",onClick:_[2]||(_[2]=C=>Z("场景树3"))}),e.createVNode(k,{name:"donghuafangzhen",size:"24",onClick:_[3]||(_[3]=C=>Z("场景4"))})]),e.createElementVNode("div",st,[e.createVNode(k,{name:"donghuafangzhen",size:"24"}),e.createVNode(k,{name:"donghuafangzhen",size:"24"}),e.createVNode(k,{name:"guanjiekongzhi",size:"24",onClick:_[4]||(_[4]=C=>de("关节控制")),active:u.value&&S.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(k,{name:"donghuafangzhen",size:"24"}),e.createVNode(k,{name:"donghuafangzhen",size:"24"}),e.createVNode(k,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",nt,[e.createVNode(k,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:($=y.value)==null?void 0:$.fastBackward},null,8,["onClick"]),e.createVNode(k,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:pe}),e.createVNode(k,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(X=y.value)==null?void 0:X.fastForward},null,8,["onClick"]),e.createVNode(k,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(G=y.value)==null?void 0:G.pauseAnimation},null,8,["onClick"]),e.createVNode(k,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(J=y.value)==null?void 0:J.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",at,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(V.value),1),e.createElementVNode("span",{class:"close",onClick:_[5]||(_[5]=C=>L.value=!1)}," X ")]),e.createVNode(B,{"max-height":"650px"},{default:e.withCtx(()=>[V.value==="场景树"?(e.openBlock(),e.createBlock(ze,{key:0,model:e.unref(H)},null,8,["model"])):e.createCommentVNode("",!0),V.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("div",ct,[e.createElementVNode("label",ht,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":_[6]||(_[6]=C=>e.isRef(v)?v.value=C:null),onChange:_[7]||(_[7]=(...C)=>e.unref(b)&&e.unref(b)(...C))},null,544),[[e.vModelRadio,e.unref(v)]]),_[15]||(_[15]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",ut,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":_[8]||(_[8]=C=>e.isRef(v)?v.value=C:null),onChange:_[9]||(_[9]=(...C)=>e.unref(b)&&e.unref(b)(...C))},null,544),[[e.vModelRadio,e.unref(v)]]),_[16]||(_[16]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",dt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":_[10]||(_[10]=C=>e.isRef(v)?v.value=C:null),onChange:_[11]||(_[11]=(...C)=>e.unref(b)&&e.unref(b)(...C))},null,544),[[e.vModelRadio,e.unref(v)]]),_[17]||(_[17]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",pt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":_[12]||(_[12]=C=>e.isRef(v)?v.value=C:null),onChange:_[13]||(_[13]=(...C)=>e.unref(b)&&e.unref(b)(...C))},null,544),[[e.vModelRadio,e.unref(v)]]),_[18]||(_[18]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,L.value]]),e.withDirectives(e.createElementVNode("div",mt,[e.createElementVNode("div",ft,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:_[14]||(_[14]=C=>u.value=!1)}," X ")]),e.createVNode(B,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(qe,{ref_key:"jointRef",ref:y,model:e.unref(H),scene:e.unref(p),animationData:l==null?void 0:l.animationData},null,8,["model","scene","animationData"]),[[e.vShow,S.value==="关节控制"]])]),_:1})],512),[[e.vShow,u.value]]),w.value?(e.openBlock(),e.createElementBlock("div",_t,[_[19]||(_[19]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(P.value),1)])):e.createCommentVNode("",!0)])}}},yt=W._export_sfc(gt,[["__scopeId","data-v-fa07a7ad"]]);exports.default=yt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),i=require("./threeModel.vue_vue_type_style_index_0_scoped_fa07a7ad_lang-DCn4bomb.cjs"),W=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ae={type:"change"},oe={type:"start"},re={type:"end"},q=new i.Ray,le=new i.Plane,me=Math.cos(70*i.MathUtils.DEG2RAD),z=new i.Vector3,F=2*Math.PI,x={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ee=1e-6;class fe extends i.Controls{constructor(t,o=null){super(t,o),this.state=x.NONE,this.target=new i.Vector3,this.cursor=new i.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.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:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new i.Vector3,this._lastQuaternion=new i.Quaternion,this._lastTargetPosition=new i.Vector3,this._quat=new i.Quaternion().setFromUnitVectors(t.up,new i.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new i.Spherical,this._sphericalDelta=new i.Spherical,this._scale=1,this._panOffset=new i.Vector3,this._rotateStart=new i.Vector2,this._rotateEnd=new i.Vector2,this._rotateDelta=new i.Vector2,this._panStart=new i.Vector2,this._panEnd=new i.Vector2,this._panDelta=new i.Vector2,this._dollyStart=new i.Vector2,this._dollyEnd=new i.Vector2,this._dollyDelta=new i.Vector2,this._dollyDirection=new i.Vector3,this._mouse=new i.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=ge.bind(this),this._onPointerDown=_e.bind(this),this._onPointerUp=ye.bind(this),this._onContextMenu=xe.bind(this),this._onMouseWheel=Ee.bind(this),this._onKeyDown=we.bind(this),this._onTouchStart=Pe.bind(this),this._onTouchMove=Me.bind(this),this._onMouseDown=ve.bind(this),this._onMouseMove=be.bind(this),this._interceptControlDown=De.bind(this),this._interceptControlUp=Se.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(t){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"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(ae),this.update(),this.state=x.NONE}update(t=null){const o=this.object.position;z.copy(o).sub(this.target),z.applyQuaternion(this._quat),this._spherical.setFromVector3(z),this.autoRotate&&this.state===x.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);let n=this.minAzimuthAngle,l=this.maxAzimuthAngle;isFinite(n)&&isFinite(l)&&(n<-Math.PI?n+=F:n>Math.PI&&(n-=F),l<-Math.PI?l+=F:l>Math.PI&&(l-=F),n<=l?this._spherical.theta=Math.max(n,Math.min(l,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+l)/2?Math.max(n,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);let p=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const g=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),p=g!=this._spherical.radius}if(z.setFromSpherical(this._spherical),z.applyQuaternion(this._quatInverse),o.copy(this.target).add(z),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){let g=null;if(this.object.isPerspectiveCamera){const r=z.length();g=this._clampDistance(r*this._scale);const w=r-g;this.object.position.addScaledVector(this._dollyDirection,w),this.object.updateMatrixWorld(),p=!!w}else if(this.object.isOrthographicCamera){const r=new i.Vector3(this._mouse.x,this._mouse.y,0);r.unproject(this.object);const w=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),p=w!==this.object.zoom;const P=new i.Vector3(this._mouse.x,this._mouse.y,0);P.unproject(this.object),this.object.position.sub(P).add(r),this.object.updateMatrixWorld(),g=z.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;g!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(g).add(this.object.position):(q.origin.copy(this.object.position),q.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(q.direction))<me?this.object.lookAt(this.target):(le.setFromNormalAndCoplanarPoint(this.object.up,this.target),q.intersectPlane(le,this.target))))}else if(this.object.isOrthographicCamera){const g=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),g!==this.object.zoom&&(this.object.updateProjectionMatrix(),p=!0)}return this._scale=1,this._performCursorZoom=!1,p||this._lastPosition.distanceToSquared(this.object.position)>ee||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ee||this._lastTargetPosition.distanceToSquared(this.target)>ee?(this.dispatchEvent(ae),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?F/60*this.autoRotateSpeed*t:F/60/60*this.autoRotateSpeed}_getZoomScale(t){const o=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*o)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,o){z.setFromMatrixColumn(o,0),z.multiplyScalar(-t),this._panOffset.add(z)}_panUp(t,o){this.screenSpacePanning===!0?z.setFromMatrixColumn(o,1):(z.setFromMatrixColumn(o,0),z.crossVectors(this.object.up,z)),z.multiplyScalar(t),this._panOffset.add(z)}_pan(t,o){const n=this.domElement;if(this.object.isPerspectiveCamera){const l=this.object.position;z.copy(l).sub(this.target);let p=z.length();p*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*p/n.clientHeight,this.object.matrix),this._panUp(2*o*p/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(o*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,o){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),l=t-n.left,p=o-n.top,g=n.width,r=n.height;this._mouse.x=l/g*2-1,this._mouse.y=-(p/r)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const o=this.domElement;this._rotateLeft(F*this._rotateDelta.x/o.clientHeight),this._rotateUp(F*this._rotateDelta.y/o.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){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()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let o=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),o=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),o=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),o=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),o=!0;break}o&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),n=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._rotateStart.set(n,l)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),n=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panStart.set(n,l)}}_handleTouchStartDolly(t){const o=this._getSecondPointerPosition(t),n=t.pageX-o.x,l=t.pageY-o.y,p=Math.sqrt(n*n+l*l);this._dollyStart.set(0,p)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),l=.5*(t.pageX+n.x),p=.5*(t.pageY+n.y);this._rotateEnd.set(l,p)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const o=this.domElement;this._rotateLeft(F*this._rotateDelta.x/o.clientHeight),this._rotateUp(F*this._rotateDelta.y/o.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),n=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panEnd.set(n,l)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const o=this._getSecondPointerPosition(t),n=t.pageX-o.x,l=t.pageY-o.y,p=Math.sqrt(n*n+l*l);this._dollyEnd.set(0,p),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const g=(t.pageX+o.x)*.5,r=(t.pageY+o.y)*.5;this._updateZoomParameters(g,r)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let o=0;o<this._pointers.length;o++)if(this._pointers[o]==t.pointerId){this._pointers.splice(o,1);return}}_isTrackingPointer(t){for(let o=0;o<this._pointers.length;o++)if(this._pointers[o]==t.pointerId)return!0;return!1}_trackPointer(t){let o=this._pointerPositions[t.pointerId];o===void 0&&(o=new i.Vector2,this._pointerPositions[t.pointerId]=o),o.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const o=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[o]}_customWheelEvent(t){const o=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(o){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function _e(a){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(a.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(a)&&(this._addPointer(a),a.pointerType==="touch"?this._onTouchStart(a):this._onMouseDown(a)))}function ge(a){this.enabled!==!1&&(a.pointerType==="touch"?this._onTouchMove(a):this._onMouseMove(a))}function ye(a){switch(this._removePointer(a),this._pointers.length){case 0:this.domElement.releasePointerCapture(a.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(re),this.state=x.NONE;break;case 1:const t=this._pointers[0],o=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:o.x,pageY:o.y});break}}function ve(a){let t;switch(a.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(a),this.state=x.DOLLY;break;case i.MOUSE.ROTATE:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=x.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=x.ROTATE}break;case i.MOUSE.PAN:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=x.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=x.PAN}break;default:this.state=x.NONE}this.state!==x.NONE&&this.dispatchEvent(oe)}function be(a){switch(this.state){case x.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(a);break;case x.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(a);break;case x.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(a);break}}function Ee(a){this.enabled===!1||this.enableZoom===!1||this.state!==x.NONE||(a.preventDefault(),this.dispatchEvent(oe),this._handleMouseWheel(this._customWheelEvent(a)),this.dispatchEvent(re))}function we(a){this.enabled!==!1&&this._handleKeyDown(a)}function Pe(a){switch(this._trackPointer(a),this._pointers.length){case 1:switch(this.touches.ONE){case i.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(a),this.state=x.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(a),this.state=x.TOUCH_PAN;break;default:this.state=x.NONE}break;case 2:switch(this.touches.TWO){case i.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(a),this.state=x.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(a),this.state=x.TOUCH_DOLLY_ROTATE;break;default:this.state=x.NONE}break;default:this.state=x.NONE}this.state!==x.NONE&&this.dispatchEvent(oe)}function Me(a){switch(this._trackPointer(a),this.state){case x.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(a),this.update();break;case x.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(a),this.update();break;case x.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(a),this.update();break;case x.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(a),this.update();break;default:this.state=x.NONE}}function xe(a){this.enabled!==!1&&a.preventDefault()}function De(a){a.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Se(a){a.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Ve(a){let t=null,o=null,n=null,l=null,p=null,g=null,r=null,w=null;const P=e.ref([]),D=e.ref(new i.Vector3),L=e.ref(new i.Vector3),k=()=>{if(!a.value)return;t=new i.Scene,t.background=new i.Color(15790320);const f=a.value;o=new i.PerspectiveCamera(75,f.clientWidth/f.clientHeight,.1,1e4),o.position.set(8,-8,6),o.up.set(0,0,1),o.lookAt(0,0,0),n=new i.WebGLRenderer({antialias:!0,alpha:!0}),n.setSize(f.clientWidth,f.clientHeight),n.localClippingEnabled=!0,n.shadowMap.enabled=!0,n.shadowMap.type=i.PCFSoftShadowMap,n.toneMapping=i.ACESFilmicToneMapping,n.toneMappingExposure=1,n.outputColorSpace=i.SRGBColorSpace,f.appendChild(n.domElement),l=new fe(o,n.domElement),l.enableDamping=!0,l.dampingFactor=.05,l.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.PAN,RIGHT:null},l.panSpeed=.7,p=new i.Xe(o,n,{container:f,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),p.attachControls(l),y(),s()},u=(f,c)=>{r&&(t.remove(r),r.dispose()),w&&(t.remove(w),w.geometry.dispose(),w.material.dispose());const M=Math.min(Math.max(Math.floor(f/20),30),40);r=new i.GridHelper(f,M,13421772,14540253),r.rotateX(Math.PI/2),r.position.copy(c),t.add(r);const U=new i.PlaneGeometry(f,f),h=new i.ShadowMaterial({opacity:.3,color:0});w=new i.Mesh(U,h),w.position.copy(c),w.position.z-=.01,w.receiveShadow=!0,t.add(w)},S=()=>{if(P.value.length===0)return;const f=new i.Box3;P.value.forEach(d=>{f.expandByObject(d)});const c=f.getSize(new i.Vector3),M=f.getCenter(new i.Vector3),U=Math.max(c.x,c.y,c.z),h=Math.max(U*8,50),v=new i.Vector3(M.x,M.y,f.min.z);u(h,v)},y=()=>{const f=new i.AmbientLight(4210752,.6);t.add(f);const c=new i.DirectionalLight(16777215,2);c.position.set(10,10,8),c.castShadow=!0,c.shadow.mapSize.width=4096,c.shadow.mapSize.height=4096,c.shadow.camera.near=.5,c.shadow.camera.far=50,c.shadow.camera.left=-50,c.shadow.camera.right=50,c.shadow.camera.top=50,c.shadow.camera.bottom=-50,t.add(c);const M=new i.DirectionalLight(16777215,.8);M.position.set(-8,-8,6),t.add(M);const U=new i.DirectionalLight(16777215,.6);U.position.set(0,-15,2),t.add(U);const h=new i.HemisphereLight(16777215,4473924,.8);t.add(h);const v=new i.PointLight(16777215,1,50);v.position.set(15,15,15),t.add(v);const d=new i.PointLight(16777215,.5,50);d.position.set(-15,-15,15),t.add(d)},s=()=>{g=requestAnimationFrame(s),l&&l.update(),n&&t&&o&&n.render(t,o),p&&p.render()},m=f=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(M=>{f[M]&&f[M].dispose&&f[M].dispose()}),f.dispose&&f.dispose()},E=f=>{f==null||f.traverse(c=>{c.geometry&&c.geometry.dispose(),c.material&&(Array.isArray(c.material)?c.material.forEach(M=>{m(M)}):m(c.material))})};return{currentModels:P,initialCameraPosition:D,initialTargetPosition:L,initThreeJS:k,handleResize:()=>{if(!a.value||!o||!n||!p)return;const f=a.value,c=f.clientWidth,M=f.clientHeight;o.aspect=c/M,o.updateProjectionMatrix(),n.setSize(c,M),p.update()},fitCameraToAllModels:()=>{if(!o||!l||P.value.length===0)return;const f=new i.Box3;P.value.forEach(d=>{f.expandByObject(d)});const c=f.getSize(new i.Vector3),M=f.getCenter(new i.Vector3),h=Math.max(c.x,c.y,c.z)*.8,v=new i.Vector3(M.x+h,M.y-h,M.z+h);o.position.copy(v),o.lookAt(M),l.target.copy(M),l.update(),D.value.copy(v),L.value.copy(M),S()},getThreeJSObjects:()=>({scene:t,camera:o,renderer:n,controls:l,gizmo:p}),clearAllModels:()=>{if(!t)return;P.value.forEach(c=>{t.remove(c),E(c)});const f=[];t.children.forEach(c=>{!c.isLight&&!c.isCamera&&c.type!=="GridHelper"&&c!==w&&f.push(c)}),f.forEach(c=>{t.remove(c),E(c)}),P.value=[],S()},cleanup:()=>{g&&cancelAnimationFrame(g),r&&r.dispose(),w&&(w.geometry.dispose(),w.material.dispose()),n&&n.dispose(),l&&l.dispose(),p&&p.dispose()},updateGridForModels:S}}function ke(a,t){const o=e.ref(!1);let n=null,l=12700,p=new i.Vector3,g=new i.Vector3,r=new i.Vector3,w=0,P=null;const D=s=>s<.5?4*s*s*s:1-Math.pow(-2*s+2,3)/2,L=s=>{const m=new i.Vector3,E=w*1.2,C=new i.Vector3(r.x+E,r.y,r.z),j=new i.Vector3(r.x,r.y+E,r.z),R=new i.Vector3(r.x,r.y-E,r.z);if(s<=.567){const I=s/.567*Math.PI*2;m.x=r.x+Math.cos(I)*E,m.z=r.z+Math.sin(I)*E,m.y=r.y}else if(s<=.724){const N=(s-.567)/.157,I=D(N);m.lerpVectors(C,j,I)}else if(s<=.881){const N=(s-.724)/.157,f=D(N)*Math.PI;m.x=r.x+Math.sin(f)*E,m.y=r.y+Math.cos(f)*E,m.z=r.z}else{const N=(s-.881)/.119,I=D(N);m.lerpVectors(R,p,I)}return m},k=()=>{const{camera:s,controls:m}=a();if(!s||!m)return;n||(n=Date.now());const E=Date.now()-n,C=Math.min(E/l,1);if(C>=1){S();return}const j=L(C);s.position.copy(j),s.lookAt(r),m.target.copy(r),P=requestAnimationFrame(k)},u=()=>{if(t.value.length===0)return;const{camera:s,controls:m}=a();if(!s||!m)return;p.copy(s.position),g.copy(m.target);const E=new i.Box3;t.value.forEach(c=>{E.expandByObject(c)});const C=E.getSize(new i.Vector3);r=E.getCenter(new i.Vector3),w=Math.max(C.x,C.y,C.z)*1.2;const j=new i.Vector3(r.x+w*1.2,r.y,r.z);m.enabled=!1;const R=s.position.clone(),N=1e3,I=Date.now(),f=()=>{const c=Date.now()-I,M=Math.min(c/N,1),U=D(M);s.position.lerpVectors(R,j,U),s.lookAt(r),m.target.copy(r),M<1?requestAnimationFrame(f):(o.value=!0,n=null,k())};f()},S=()=>{o.value=!1,n=null,P&&(cancelAnimationFrame(P),P=null);const{controls:s}=a();s&&(s.enabled=!0,s.target.copy(g))};return{isAnimating:o,toggleAnimation:()=>{if(o.value){o.value=!1,n=null,P&&(cancelAnimationFrame(P),P=null);const{camera:s,controls:m}=a();if(!s||!m)return;m.enabled=!0;const E=s.position.clone(),C=m.target.clone(),j=1500,R=Date.now(),N=()=>{const I=Date.now()-R,f=Math.min(I/j,1),c=D(f);s.position.lerpVectors(E,p,c),m.target.lerpVectors(C,g,c),f<1&&requestAnimationFrame(N)};N()}else u()},startAnimation:u,stopAnimation:S}}function Te(a,t){const o=e.ref(!1),n=e.ref("none");let l=[],p=[],g=new i.Box3,r=new i.Vector3;const w=()=>{l=[new i.Plane(new i.Vector3(1,0,0),0),new i.Plane(new i.Vector3(0,1,0),0),new i.Plane(new i.Vector3(0,0,1),0)]},P=()=>{g.makeEmpty(),t.value.forEach(y=>{g.expandByObject(y)}),r=g.getCenter(new i.Vector3)},D=y=>{const s=g.getSize(new i.Vector3);let m,E,C;y==="x"?(m=new i.PlaneGeometry(s.z*1.2,s.y*1.2),E=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(0,Math.PI/2,0)):y==="y"?(m=new i.PlaneGeometry(s.x*1.2,s.z*1.2),E=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(Math.PI/2,0,0)):y==="z"&&(m=new i.PlaneGeometry(s.x*1.2,s.y*1.2),E=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(0,0,0));const j=new i.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:i.DoubleSide,depthWrite:!1}),R=new i.Mesh(m,j);return R.position.copy(E),R.rotation.copy(C),R},L=()=>{if(k(),u(),n.value==="none")return;P();let y=null;if(n.value==="x"?(l[0].constant=-r.x,y=l[0]):n.value==="y"?(l[1].constant=-r.y,y=l[1]):n.value==="z"&&(l[2].constant=-r.z,y=l[2]),y){t.value.forEach(m=>{m.traverse(E=>{E.isMesh&&E.material&&(Array.isArray(E.material)?E.material.forEach(C=>{C.clippingPlanes=[y]}):E.material.clippingPlanes=[y])})});const{scene:s}=a();if(s){const m=D(n.value);s.add(m),p.push(m)}}},k=()=>{t.value.forEach(y=>{y.traverse(s=>{s.isMesh&&s.material&&(Array.isArray(s.material)?s.material.forEach(m=>{m.clippingPlanes=[]}):s.material.clippingPlanes=[])})})},u=()=>{const{scene:y}=a();y&&p.forEach(s=>{y.remove(s),s.geometry.dispose(),s.material.dispose()}),p=[]};return{isClipping:o,activeClippingAxis:n,toggleClipping:()=>{o.value=!o.value,o.value?(w(),t.value.length>0&&P()):(n.value="none",k(),u())},updateClippingPlanes:L,clearClippingPlanes:k,clearClippingMeshes:u}}const Ce={class:"panel-content"},Ae="id",Ne={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:a=>["breadth","firstLevel"].includes(a)}},emits:["nodeClick"],setup(a,{emit:t}){const o=a,n=t,l=e.ref([]),p={children:"children",label:"label"},g=u=>{n("nodeClick",u)},r=(u,S=0)=>{const y=[];return Array.isArray(u)&&(u==null?void 0:u.length)>0&&u.forEach(s=>{if(!(s!=null&&s.isMesh)&&((s==null?void 0:s.type)==="URDFJoint"||(s==null?void 0:s.type)==="URDFLink")){const m={name:s==null?void 0:s.name,label:s==null?void 0:s.name,show:!0,level:S+1,isPenultimate:!1,type:s==null?void 0:s.type,id:s==null?void 0:s.id,limit:(s==null?void 0:s.limit)??"",children:r(s==null?void 0:s.children,S+1),path:s==null?void 0:s.name};y.push(m)}}),y},w=u=>u?[{name:u==null?void 0:u.name,label:u==null?void 0:u.name,show:!0,level:1,isPenultimate:!1,type:u==null?void 0:u.type,id:u==null?void 0:u.id,limit:(u==null?void 0:u.limit)??"",children:r(u==null?void 0:u.children,1),path:u==null?void 0:u.name}]:[],P=(u,S)=>{const y=[],s=[...u];for(;s.length>0&&y.length<S;){const m=s.shift();m.children&&m.children.length>0&&(y.push(m.id),s.push(...m.children))}return y},D=(u,S)=>{const y=[];return u.forEach(s=>{if(s.children&&s.children.length>0){y.push(s.id);const m=s.children.filter(E=>E.children&&E.children.length>0).slice(0,S).map(E=>E.id);y.push(...m)}}),y.slice(0,S+1)},L=e.computed(()=>!l.value||l.value.length===0?[]:o.expandStrategy==="firstLevel"?D(l.value,o.maxExpandCount):P(l.value,o.maxExpandCount)),k=e.computed(()=>o!=null&&o.model?w(o.model):[]);return e.watch(k,u=>{l.value=JSON.parse(JSON.stringify(u))},{immediate:!0}),(u,S)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Ce,[e.createVNode(y,{data:l.value,props:p,"default-expanded-keys":L.value,"node-key":Ae,onNodeClick:g},null,8,["data","default-expanded-keys"])])}}},ze=W._export_sfc(Ne,[["__scopeId","data-v-290ff4e1"]]),Oe={class:"panel-content"},Re={key:0,class:"joints-list"},Le={class:"joint-info-row"},je={class:"joint-left"},Ie={class:"joint-name"},Ue={class:"joint-range"},Fe={class:"joint-type"},Be={key:0,class:"joint-control-row"},Ye={class:"slider-container"},He=["min","max","value","onInput","disabled"],Ke={class:"value-display"},Ze={class:"joint-value"},$e={class:"unit"},Xe={key:1,class:"empty-state"},Ge=1e3,te=60,Je={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Array},setup(a,{expose:t}){const o=a;e.ref(!0);const n=e.ref([]),l=e.ref(null),p=e.ref(!1),g=e.ref(!1),r=e.ref(0),w=e.ref(0),P=e.ref(null),D=e.ref(1),L=()=>Ge/te/D.value;let k=[];e.watch(()=>o.animationData,h=>{h&&h.length>0&&(k=h,C())},{deep:!0});const u=(h,v=!1)=>h==="revolute"?v?Math.PI:-Math.PI:h==="prismatic"?v?1:-1:0,S=h=>{if(!h||!h.joints)return console.warn("URDF模型没有关节信息"),[];const v=[];return Object.keys(h.joints).forEach(d=>{const b=h.joints[d];if(b._jointType==="fixed")return;const O=b.limit?{lower:b.limit.lower??u(b._jointType,!1),upper:b.limit.upper??u(b._jointType,!0)}:{lower:u(b._jointType,!1),upper:u(b._jointType,!0)};v.push({name:d,type:b._jointType||"unknown",limit:O,currentValue:b.angle||0,urdfJoint:b})}),v.sort((d,b)=>d.name.localeCompare(b.name))},y=(h,v)=>{const d=n.value.find(O=>O.name===h);if(!d)return;const b=parseFloat(v);if(d.limit){const O=Math.max(d.limit.lower,Math.min(d.limit.upper,b));d.currentValue=O}else d.currentValue=b;o.model&&o.model.setJointValue?o.model.setJointValue(h,d.currentValue):d.urdfJoint&&d.urdfJoint.setJointValue(d.currentValue)},s=h=>{h&&Object.keys(h).forEach(v=>{const d=h[v],b=n.value.find(O=>O.name===v);b&&(b.currentValue=d,o.model&&o.model.setJointValue?o.model.setJointValue(v,d):b.urdfJoint&&b.urdfJoint.setJointValue(d))})},m=(h,v,d)=>h+(v-h)*d,E=(h,v,d)=>{if(!h||!v)return h||v;const b={};return Object.keys(h).forEach(O=>{const Y=h[O],H=v[O];b[O]=m(Y,H||Y,d)}),b},C=()=>{if(k.length===0){console.warn("没有动画数据");return}console.log(232,111),p.value=!0,g.value=!1;const h=()=>{if(!p.value||g.value)return;const v=w.value/te,d=k[r.value],b=k[r.value+1];if(b){const O=E(d,b,v);s(O)}else s(d);if(w.value++,w.value>=te&&(w.value=0,r.value++,r.value>=k.length-1)){R();return}P.value=setTimeout(h,L())};h()},j=()=>{g.value=!0,P.value&&(clearTimeout(P.value),P.value=null)},R=()=>{p.value=!1,g.value=!1,D.value=1,P.value&&(clearTimeout(P.value),P.value=null)};t({startAnimation:C,pauseAnimation:j,stopAnimation:R,resetAll:()=>{R(),r.value=0,w.value=0,n.value.forEach(h=>{(h.type==="revolute"||h.type==="prismatic")&&y(h.name,0)})},fastForward:()=>{D.value<4&&(D.value=Math.min(4,D.value*2))},fastBackward:()=>{D.value>.25&&(D.value=Math.max(.25,D.value/2))}}),e.watch(()=>o.model,h=>{h?n.value=S(h):n.value=[]},{immediate:!0});const c=()=>{!o.model||p.value&&!g.value||n.value.forEach(h=>{h.urdfJoint&&h.urdfJoint.angle!==void 0&&(h.currentValue=h.urdfJoint.angle)})},M=()=>{const h=()=>{c(),l.value=requestAnimationFrame(h)};h()},U=()=>{l.value&&(cancelAnimationFrame(l.value),l.value=null)};return e.onMounted(()=>{M()}),e.onUnmounted(()=>{U(),R()}),(h,v)=>(e.openBlock(),e.createElementBlock("div",Oe,[n.value.length>0?(e.openBlock(),e.createElementBlock("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,d=>{var b,O,Y,H;return e.openBlock(),e.createElementBlock("div",{key:d.name,class:"joint-item"},[e.createElementVNode("div",Le,[e.createElementVNode("div",je,[e.createElementVNode("span",Ie,e.toDisplayString(d.name),1),e.createElementVNode("span",Ue," ["+e.toDisplayString(((b=d.limit)==null?void 0:b.lower.toFixed(2))??(d.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((O=d.limit)==null?void 0:O.upper.toFixed(2))??(d.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",Fe,e.toDisplayString(d.type),1)]),d.type==="revolute"||d.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Ye,[e.createElementVNode("input",{type:"range",min:((Y=d.limit)==null?void 0:Y.lower)??(d.type==="revolute"?-Math.PI:-1),max:((H=d.limit)==null?void 0:H.upper)??(d.type==="revolute"?Math.PI:1),step:.01,value:d.currentValue,onInput:Q=>y(d.name,Q.target.value),class:"joint-slider",disabled:p.value&&!g.value},null,40,He)]),e.createElementVNode("div",Ke,[e.createElementVNode("span",Ze,e.toDisplayString(d.currentValue.toFixed(3)),1),e.createElementVNode("span",$e,e.toDisplayString(d.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Xe,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},qe=W._export_sfc(Je,[["__scopeId","data-v-007cd1b2"]]),We=["xlink:href"],Qe=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(a){const t=a,o=e.computed(()=>({backgroundColor:t.backgroundColor})),n=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>{const{size:p}=t;let g=`${p}`;return g=`${g.replace("px","")}px`,{width:g,height:g}});return(p,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:p.active}]),style:e.normalizeStyle(o.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[p.$attrs.class,p.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(l.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":n.value},null,8,We)],6))],6))}}),T=W._export_sfc(Qe,[["__scopeId","data-v-3150a90b"]]),et={class:"obj-viewer-container"},tt={class:"buttonGroup-top"},ot={class:"buttonGroup-topLeft"},it={class:"buttonGroup-left"},st={class:"buttonGroup-right"},nt={class:"buttonGroup-bottom"},at={class:"left-panel"},lt={class:"panel-header"},rt={key:1,class:"clipping-content"},ct={class:"radio-group"},ht={class:"radio-label"},ut={class:"radio-label"},dt={class:"radio-label"},pt={class:"radio-label"},mt={class:"right-panel"},ft={class:"panel-header"},_t={key:0,class:"loading-overlay"},gt={__name:"threeModel",props:{animationData:{type:Array,default:[]}},emits:["getAnimationData"],setup(a,{expose:t,emit:o}){const n=o,l=a;let p=null,g=!1;const r=e.ref(null),w=e.ref(!1),P=e.ref("");e.ref(!1);const D=e.ref(!1),L=e.ref(!1),k=e.ref(""),u=e.ref(!1),S=e.ref(""),y=e.ref(),{currentModels:s,initialCameraPosition:m,initialTargetPosition:E,initThreeJS:C,handleResize:j,fitCameraToAllModels:R,getThreeJSObjects:N,clearAllModels:I,cleanup:f}=Ve(r),{isAnimating:c,toggleAnimation:M,stopAnimation:U}=ke(N,s),{isClipping:h,activeClippingAxis:v,toggleClipping:d,updateClippingPlanes:b}=Te(N,s),{addModelsFromUrls:O,loadModelByDefaultPath:Y,urdfModel:H}=i.useModelLoader(N,s,w,P,I),Q=()=>{if(D.value||s.value.length===0)return;D.value=!0,c.value&&U();const{camera:A,controls:_}=N();if(!A||!_)return;_.enabled=!0;const B=K=>K<.5?4*K*K*K:1-Math.pow(-2*K+2,3)/2,$=A.position.clone(),X=_.target.clone(),G=1500,J=Date.now(),V=()=>{const K=Date.now()-J,se=Math.min(K/G,1),ne=B(se);A.position.lerpVectors($,m.value,ne),_.target.lerpVectors(X,E.value,ne),se<1?requestAnimationFrame(V):D.value=!1};V()},ce=async()=>g?Promise.resolve():new Promise(A=>{const _=()=>{g?A():requestAnimationFrame(_)};_()}),ie=async(A,_)=>{try{await ce(),c.value&&U(),h.value&&d();const B=await _(A);return R(),B}catch(B){throw console.error("加载模型失败:",B),B}},he=async A=>ie(A,O),ue=async A=>ie(A,Y),Z=A=>{L.value=!0,k.value=A,A==="剖面视图"&&!h.value&&d()},de=A=>{u.value=!0,S.value=A},pe=()=>{n("getAnimationData"),e.nextTick(()=>{var A;(A=y.value)==null||A.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{C(),p=N().scene,g=!0,window.addEventListener("resize",j)}catch(A){console.error("Three.js初始化失败:",A)}}),e.onBeforeUnmount(()=>{g=!1,k.value="",S.value="",window.removeEventListener("resize",j),c.value&&U(),f()}),t({addModelsFromUrls:he,loadModelByDefaultPath:ue}),(A,_)=>{var $,X,G,J;const B=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",et,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",tt,[e.createVNode(T,{name:"guanjianjiexi",size:"34"}),e.createVNode(T,{name:"guanjiekongzhi",size:"34"}),e.createVNode(T,{name:"gongyishengcheng",size:"34"}),e.createVNode(T,{name:"buchangshezhi",size:"34"}),e.createVNode(T,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",ot,[e.createVNode(T,{name:"viewReset",size:"24",onClick:Q,title:"重置"}),e.createVNode(T,{name:"fangda",size:"24",title:"放大"}),e.createVNode(T,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(T,{name:"lookAround",size:"24",onClick:e.unref(M),title:e.unref(c)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",it,[e.createVNode(T,{name:"jiegoushu",size:"24",onClick:_[0]||(_[0]=V=>Z("场景树")),active:L.value&&k.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(T,{name:"clipping",size:"24",onClick:_[1]||(_[1]=V=>Z("剖面视图")),active:L.value&&k.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(T,{name:"donghuafangzhen",size:"24",onClick:_[2]||(_[2]=V=>Z("场景树3"))}),e.createVNode(T,{name:"donghuafangzhen",size:"24",onClick:_[3]||(_[3]=V=>Z("场景4"))})]),e.createElementVNode("div",st,[e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"guanjiekongzhi",size:"24",onClick:_[4]||(_[4]=V=>de("关节控制")),active:u.value&&S.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",nt,[e.createVNode(T,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:($=y.value)==null?void 0:$.fastBackward},null,8,["onClick"]),e.createVNode(T,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:pe}),e.createVNode(T,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(X=y.value)==null?void 0:X.fastForward},null,8,["onClick"]),e.createVNode(T,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(G=y.value)==null?void 0:G.pauseAnimation},null,8,["onClick"]),e.createVNode(T,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(J=y.value)==null?void 0:J.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",at,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(k.value),1),e.createElementVNode("span",{class:"close",onClick:_[5]||(_[5]=V=>L.value=!1)}," X ")]),e.createVNode(B,{"max-height":"650px"},{default:e.withCtx(()=>[k.value==="场景树"?(e.openBlock(),e.createBlock(ze,{key:0,model:e.unref(H)},null,8,["model"])):e.createCommentVNode("",!0),k.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("div",ct,[e.createElementVNode("label",ht,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":_[6]||(_[6]=V=>e.isRef(v)?v.value=V:null),onChange:_[7]||(_[7]=(...V)=>e.unref(b)&&e.unref(b)(...V))},null,544),[[e.vModelRadio,e.unref(v)]]),_[15]||(_[15]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",ut,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":_[8]||(_[8]=V=>e.isRef(v)?v.value=V:null),onChange:_[9]||(_[9]=(...V)=>e.unref(b)&&e.unref(b)(...V))},null,544),[[e.vModelRadio,e.unref(v)]]),_[16]||(_[16]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",dt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":_[10]||(_[10]=V=>e.isRef(v)?v.value=V:null),onChange:_[11]||(_[11]=(...V)=>e.unref(b)&&e.unref(b)(...V))},null,544),[[e.vModelRadio,e.unref(v)]]),_[17]||(_[17]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",pt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":_[12]||(_[12]=V=>e.isRef(v)?v.value=V:null),onChange:_[13]||(_[13]=(...V)=>e.unref(b)&&e.unref(b)(...V))},null,544),[[e.vModelRadio,e.unref(v)]]),_[18]||(_[18]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,L.value]]),e.withDirectives(e.createElementVNode("div",mt,[e.createElementVNode("div",ft,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:_[14]||(_[14]=V=>u.value=!1)}," X ")]),e.createVNode(B,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(qe,{ref_key:"jointRef",ref:y,model:e.unref(H),scene:e.unref(p),animationData:l==null?void 0:l.animationData},null,8,["model","scene","animationData"]),[[e.vShow,S.value==="关节控制"]])]),_:1})],512),[[e.vShow,u.value]]),w.value?(e.openBlock(),e.createElementBlock("div",_t,[_[19]||(_[19]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(P.value),1)])):e.createCommentVNode("",!0)])}}},yt=W._export_sfc(gt,[["__scopeId","data-v-fa07a7ad"]]);exports.default=yt;
|