ss-component-new 1.1.586 → 1.1.587

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),i=require("./index-BXdjo_xA.cjs"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),fe=require("./menu-DYsWoy6Z.cjs"),pe={type:"change"},ue={type:"start"},_e={type:"end"},ae=new i.Ray,me=new i.Plane,ge=Math.cos(70*i.MathUtils.DEG2RAD),L=new i.Vector3,H=2*Math.PI,k={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},re=1e-6;class ye extends i.Controls{constructor(t,o=null){super(t,o),this.state=k.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=be.bind(this),this._onPointerDown=ve.bind(this),this._onPointerUp=we.bind(this),this._onContextMenu=Se.bind(this),this._onMouseWheel=Me.bind(this),this._onKeyDown=xe.bind(this),this._onTouchStart=De.bind(this),this._onTouchMove=ke.bind(this),this._onMouseDown=Ee.bind(this),this._onMouseMove=Pe.bind(this),this._interceptControlDown=Ve.bind(this),this._interceptControlUp=Te.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(pe),this.update(),this.state=k.NONE}update(t=null){const o=this.object.position;L.copy(o).sub(this.target),L.applyQuaternion(this._quat),this._spherical.setFromVector3(L),this.autoRotate&&this.state===k.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 s=this.minAzimuthAngle,l=this.maxAzimuthAngle;isFinite(s)&&isFinite(l)&&(s<-Math.PI?s+=H:s>Math.PI&&(s-=H),l<-Math.PI?l+=H:l>Math.PI&&(l-=H),s<=l?this._spherical.theta=Math.max(s,Math.min(l,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+l)/2?Math.max(s,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 f=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const _=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),f=_!=this._spherical.radius}if(L.setFromSpherical(this._spherical),L.applyQuaternion(this._quatInverse),o.copy(this.target).add(L),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 _=null;if(this.object.isPerspectiveCamera){const r=L.length();_=this._clampDistance(r*this._scale);const w=r-_;this.object.position.addScaledVector(this._dollyDirection,w),this.object.updateMatrixWorld(),f=!!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(),f=w!==this.object.zoom;const M=new i.Vector3(this._mouse.x,this._mouse.y,0);M.unproject(this.object),this.object.position.sub(M).add(r),this.object.updateMatrixWorld(),_=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;_!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(_).add(this.object.position):(ae.origin.copy(this.object.position),ae.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ae.direction))<ge?this.object.lookAt(this.target):(me.setFromNormalAndCoplanarPoint(this.object.up,this.target),ae.intersectPlane(me,this.target))))}else if(this.object.isOrthographicCamera){const _=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),_!==this.object.zoom&&(this.object.updateProjectionMatrix(),f=!0)}return this._scale=1,this._performCursorZoom=!1,f||this._lastPosition.distanceToSquared(this.object.position)>re||8*(1-this._lastQuaternion.dot(this.object.quaternion))>re||this._lastTargetPosition.distanceToSquared(this.target)>re?(this.dispatchEvent(pe),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?H/60*this.autoRotateSpeed*t:H/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){L.setFromMatrixColumn(o,0),L.multiplyScalar(-t),this._panOffset.add(L)}_panUp(t,o){this.screenSpacePanning===!0?L.setFromMatrixColumn(o,1):(L.setFromMatrixColumn(o,0),L.crossVectors(this.object.up,L)),L.multiplyScalar(t),this._panOffset.add(L)}_pan(t,o){const s=this.domElement;if(this.object.isPerspectiveCamera){const l=this.object.position;L.copy(l).sub(this.target);let f=L.length();f*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*f/s.clientHeight,this.object.matrix),this._panUp(2*o*f/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(o*(this.object.top-this.object.bottom)/this.object.zoom/s.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 s=this.domElement.getBoundingClientRect(),l=t-s.left,f=o-s.top,_=s.width,r=s.height;this._mouse.x=l/_*2-1,this._mouse.y=-(f/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(H*this._rotateDelta.x/o.clientHeight),this._rotateUp(H*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(H*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(-H*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(H*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(-H*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),s=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._rotateStart.set(s,l)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),s=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panStart.set(s,l)}}_handleTouchStartDolly(t){const o=this._getSecondPointerPosition(t),s=t.pageX-o.x,l=t.pageY-o.y,f=Math.sqrt(s*s+l*l);this._dollyStart.set(0,f)}_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 s=this._getSecondPointerPosition(t),l=.5*(t.pageX+s.x),f=.5*(t.pageY+s.y);this._rotateEnd.set(l,f)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const o=this.domElement;this._rotateLeft(H*this._rotateDelta.x/o.clientHeight),this._rotateUp(H*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),s=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panEnd.set(s,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),s=t.pageX-o.x,l=t.pageY-o.y,f=Math.sqrt(s*s+l*l);this._dollyEnd.set(0,f),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 _=(t.pageX+o.x)*.5,r=(t.pageY+o.y)*.5;this._updateZoomParameters(_,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,s={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(o){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function ve(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 be(a){this.enabled!==!1&&(a.pointerType==="touch"?this._onTouchMove(a):this._onMouseMove(a))}function we(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(_e),this.state=k.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 Ee(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=k.DOLLY;break;case i.MOUSE.ROTATE:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=k.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=k.ROTATE}break;case i.MOUSE.PAN:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=k.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=k.PAN}break;default:this.state=k.NONE}this.state!==k.NONE&&this.dispatchEvent(ue)}function Pe(a){switch(this.state){case k.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(a);break;case k.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(a);break;case k.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(a);break}}function Me(a){this.enabled===!1||this.enableZoom===!1||this.state!==k.NONE||(a.preventDefault(),this.dispatchEvent(ue),this._handleMouseWheel(this._customWheelEvent(a)),this.dispatchEvent(_e))}function xe(a){this.enabled!==!1&&this._handleKeyDown(a)}function De(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=k.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(a),this.state=k.TOUCH_PAN;break;default:this.state=k.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=k.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(a),this.state=k.TOUCH_DOLLY_ROTATE;break;default:this.state=k.NONE}break;default:this.state=k.NONE}this.state!==k.NONE&&this.dispatchEvent(ue)}function ke(a){switch(this._trackPointer(a),this.state){case k.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(a),this.update();break;case k.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(a),this.update();break;case k.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(a),this.update();break;case k.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(a),this.update();break;default:this.state=k.NONE}}function Se(a){this.enabled!==!1&&a.preventDefault()}function Ve(a){a.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Te(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,s=null,l=null,f=null,_=null,r=null,w=null;const M=e.ref([]),A=e.ref(new i.Vector3),N=e.ref(new i.Vector3),z=()=>{if(!a.value)return;t=new i.Scene,t.background=new i.Color(15790320);const p=a.value;o=new i.PerspectiveCamera(75,p.clientWidth/p.clientHeight,.1,1e4),o.position.set(8,-8,6),o.up.set(0,0,1),o.lookAt(0,0,0),s=new i.WebGLRenderer({antialias:!0,alpha:!0}),s.setSize(p.clientWidth,p.clientHeight),s.localClippingEnabled=!0,s.shadowMap.enabled=!0,s.shadowMap.type=i.PCFSoftShadowMap,s.toneMapping=i.ACESFilmicToneMapping,s.toneMappingExposure=1,s.outputColorSpace=i.SRGBColorSpace,p.appendChild(s.domElement),l=new ye(o,s.domElement),l.enableDamping=!0,l.dampingFactor=.05,l.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.PAN,RIGHT:null},l.panSpeed=.7,f=new i.Xe(o,s,{container:p,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"}}),f.attachControls(l),g(),n()},c=(p,h)=>{r&&(t.remove(r),r.dispose()),w&&(t.remove(w),w.geometry.dispose(),w.material.dispose());const E=Math.min(Math.max(Math.floor(p/20),30),40);r=new i.GridHelper(p,E,13421772,14540253),r.rotateX(Math.PI/2),r.position.copy(h),t.add(r);const Y=new i.PlaneGeometry(p,p),Z=new i.ShadowMaterial({opacity:.3,color:0});w=new i.Mesh(Y,Z),w.position.copy(h),w.position.z-=.01,w.receiveShadow=!0,t.add(w)},S=()=>{if(M.value.length===0)return;const p=new i.Box3;M.value.forEach(K=>{p.expandByObject(K)});const h=p.getSize(new i.Vector3),E=p.getCenter(new i.Vector3),Y=Math.max(h.x,h.y,h.z),Z=Math.max(Y*8,50),R=new i.Vector3(E.x,E.y,p.min.z);c(Z,R)},g=()=>{const p=new i.AmbientLight(4210752,.6);t.add(p);const h=new i.DirectionalLight(16777215,2);h.position.set(10,10,8),h.castShadow=!0,h.shadow.mapSize.width=4096,h.shadow.mapSize.height=4096,h.shadow.camera.near=.5,h.shadow.camera.far=50,h.shadow.camera.left=-50,h.shadow.camera.right=50,h.shadow.camera.top=50,h.shadow.camera.bottom=-50,t.add(h);const E=new i.DirectionalLight(16777215,.8);E.position.set(-8,-8,6),t.add(E);const Y=new i.DirectionalLight(16777215,.6);Y.position.set(0,-15,2),t.add(Y);const Z=new i.HemisphereLight(16777215,4473924,.8);t.add(Z);const R=new i.PointLight(16777215,1,50);R.position.set(15,15,15),t.add(R);const K=new i.PointLight(16777215,.5,50);K.position.set(-15,-15,15),t.add(K)},n=()=>{_=requestAnimationFrame(n),l&&l.update(),s&&t&&o&&s.render(t,o),f&&f.render()},d=p=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(E=>{p[E]&&p[E].dispose&&p[E].dispose()}),p.dispose&&p.dispose()},b=p=>{p==null||p.traverse(h=>{h.geometry&&h.geometry.dispose(),h.material&&(Array.isArray(h.material)?h.material.forEach(E=>{d(E)}):d(h.material))})};return{currentModels:M,initialCameraPosition:A,initialTargetPosition:N,initThreeJS:z,handleResize:()=>{if(!a.value||!o||!s||!f)return;const p=a.value,h=p.clientWidth,E=p.clientHeight;o.aspect=h/E,o.updateProjectionMatrix(),s.setSize(h,E),f.update()},fitCameraToAllModels:()=>{if(!o||!l||M.value.length===0)return;const p=new i.Box3;M.value.forEach(K=>{p.expandByObject(K)});const h=p.getSize(new i.Vector3),E=p.getCenter(new i.Vector3),Z=Math.max(h.x,h.y,h.z)*.8,R=new i.Vector3(E.x+Z,E.y-Z,E.z+Z);o.position.copy(R),o.lookAt(E),l.target.copy(E),l.update(),A.value.copy(R),N.value.copy(E),S()},getThreeJSObjects:()=>({scene:t,camera:o,renderer:s,controls:l,gizmo:f}),clearAllModels:()=>{if(!t)return;M.value.forEach(h=>{t.remove(h),b(h)});const p=[];t.children.forEach(h=>{!h.isLight&&!h.isCamera&&h.type!=="GridHelper"&&h!==w&&p.push(h)}),p.forEach(h=>{t.remove(h),b(h)}),M.value=[],S()},cleanup:()=>{_&&cancelAnimationFrame(_),r&&r.dispose(),w&&(w.geometry.dispose(),w.material.dispose()),s&&s.dispose(),l&&l.dispose(),f&&f.dispose()},updateGridForModels:S}}function Ae(a,t){const o=e.ref(!1);let s=null,l=12700,f=new i.Vector3,_=new i.Vector3,r=new i.Vector3,w=0,M=null;const A=n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,N=n=>{const d=new i.Vector3,b=w*1.2,C=new i.Vector3(r.x+b,r.y,r.z),U=new i.Vector3(r.x,r.y+b,r.z),B=new i.Vector3(r.x,r.y-b,r.z);if(n<=.567){const I=n/.567*Math.PI*2;d.x=r.x+Math.cos(I)*b,d.z=r.z+Math.sin(I)*b,d.y=r.y}else if(n<=.724){const O=(n-.567)/.157,I=A(O);d.lerpVectors(C,U,I)}else if(n<=.881){const O=(n-.724)/.157,p=A(O)*Math.PI;d.x=r.x+Math.sin(p)*b,d.y=r.y+Math.cos(p)*b,d.z=r.z}else{const O=(n-.881)/.119,I=A(O);d.lerpVectors(B,f,I)}return d},z=()=>{const{camera:n,controls:d}=a();if(!n||!d)return;s||(s=Date.now());const b=Date.now()-s,C=Math.min(b/l,1);if(C>=1){S();return}const U=N(C);n.position.copy(U),n.lookAt(r),d.target.copy(r),M=requestAnimationFrame(z)},c=()=>{if(t.value.length===0)return;const{camera:n,controls:d}=a();if(!n||!d)return;f.copy(n.position),_.copy(d.target);const b=new i.Box3;t.value.forEach(h=>{b.expandByObject(h)});const C=b.getSize(new i.Vector3);r=b.getCenter(new i.Vector3),w=Math.max(C.x,C.y,C.z)*1.2;const U=new i.Vector3(r.x+w*1.2,r.y,r.z);d.enabled=!1;const B=n.position.clone(),O=1e3,I=Date.now(),p=()=>{const h=Date.now()-I,E=Math.min(h/O,1),Y=A(E);n.position.lerpVectors(B,U,Y),n.lookAt(r),d.target.copy(r),E<1?requestAnimationFrame(p):(o.value=!0,s=null,z())};p()},S=()=>{o.value=!1,s=null,M&&(cancelAnimationFrame(M),M=null);const{controls:n}=a();n&&(n.enabled=!0,n.target.copy(_))};return{isAnimating:o,toggleAnimation:()=>{if(o.value){o.value=!1,s=null,M&&(cancelAnimationFrame(M),M=null);const{camera:n,controls:d}=a();if(!n||!d)return;d.enabled=!0;const b=n.position.clone(),C=d.target.clone(),U=1500,B=Date.now(),O=()=>{const I=Date.now()-B,p=Math.min(I/U,1),h=A(p);n.position.lerpVectors(b,f,h),d.target.lerpVectors(C,_,h),p<1&&requestAnimationFrame(O)};O()}else c()},startAnimation:c,stopAnimation:S}}function Ne(a,t){const o=e.ref(!1),s=e.ref("none");let l=[],f=[],_=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)]},M=()=>{_.makeEmpty(),t.value.forEach(g=>{_.expandByObject(g)}),r=_.getCenter(new i.Vector3)},A=g=>{const n=_.getSize(new i.Vector3);let d,b,C;g==="x"?(d=new i.PlaneGeometry(n.z*1.2,n.y*1.2),b=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(0,Math.PI/2,0)):g==="y"?(d=new i.PlaneGeometry(n.x*1.2,n.z*1.2),b=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(Math.PI/2,0,0)):g==="z"&&(d=new i.PlaneGeometry(n.x*1.2,n.y*1.2),b=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(0,0,0));const U=new i.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:i.DoubleSide,depthWrite:!1}),B=new i.Mesh(d,U);return B.position.copy(b),B.rotation.copy(C),B},N=()=>{if(z(),c(),s.value==="none")return;M();let g=null;if(s.value==="x"?(l[0].constant=-r.x,g=l[0]):s.value==="y"?(l[1].constant=-r.y,g=l[1]):s.value==="z"&&(l[2].constant=-r.z,g=l[2]),g){t.value.forEach(d=>{d.traverse(b=>{b.isMesh&&b.material&&(Array.isArray(b.material)?b.material.forEach(C=>{C.clippingPlanes=[g]}):b.material.clippingPlanes=[g])})});const{scene:n}=a();if(n){const d=A(s.value);n.add(d),f.push(d)}}},z=()=>{t.value.forEach(g=>{g.traverse(n=>{n.isMesh&&n.material&&(Array.isArray(n.material)?n.material.forEach(d=>{d.clippingPlanes=[]}):n.material.clippingPlanes=[])})})},c=()=>{const{scene:g}=a();g&&f.forEach(n=>{g.remove(n),n.geometry.dispose(),n.material.dispose()}),f=[]};return{isClipping:o,activeClippingAxis:s,toggleClipping:()=>{o.value=!o.value,o.value?(w(),t.value.length>0&&M()):(s.value="none",z(),c())},updateClippingPlanes:N,clearClippingPlanes:z,clearClippingMeshes:c}}const ze={class:"panel-content"},Re={__name:"animationTable",props:{animationData:Object,model:Object},setup(a){const t=a;e.ref();const o=e.ref();return e.watch(()=>[t==null?void 0:t.animationData],()=>{var l;let s=((l=fe.cloneDeep(t==null?void 0:t.animationData))==null?void 0:l.动画输出Content)??[];s&&(o.value=s)},{deep:!0,immediate:!0}),(s,l)=>{var f,_,r;return e.openBlock(),e.createElementBlock("div",ze,[(e.openBlock(),e.createBlock(i.ssTable,{itemData:(f=o.value)==null?void 0:f.compData,key:(_=o.value)==null?void 0:_.id,index:(r=o.value)==null?void 0:r.id,showHeader:!1},null,8,["itemData","index"]))])}}},Oe=ne._export_sfc(Re,[["__scopeId","data-v-02b89b4b"]]),Le={class:"panel-content"},je="id",Ie={__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,s=t,l=e.ref([]),f={children:"children",label:"label"},_=c=>{s("nodeClick",c)},r=(c,S=0)=>{const g=[];return Array.isArray(c)&&(c==null?void 0:c.length)>0&&c.forEach(n=>{if(!(n!=null&&n.isMesh)&&((n==null?void 0:n.type)==="URDFJoint"||(n==null?void 0:n.type)==="URDFLink")){const d={name:n==null?void 0:n.name,label:n==null?void 0:n.name,show:!0,level:S+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:r(n==null?void 0:n.children,S+1),path:n==null?void 0:n.name};g.push(d)}}),g},w=c=>c?[{name:c==null?void 0:c.name,label:c==null?void 0:c.name,show:!0,level:1,isPenultimate:!1,type:c==null?void 0:c.type,id:c==null?void 0:c.id,limit:(c==null?void 0:c.limit)??"",children:r(c==null?void 0:c.children,1),path:c==null?void 0:c.name}]:[],M=(c,S)=>{const g=[],n=[...c];for(;n.length>0&&g.length<S;){const d=n.shift();d.children&&d.children.length>0&&(g.push(d.id),n.push(...d.children))}return g},A=(c,S)=>{const g=[];return c.forEach(n=>{if(n.children&&n.children.length>0){g.push(n.id);const d=n.children.filter(b=>b.children&&b.children.length>0).slice(0,S).map(b=>b.id);g.push(...d)}}),g.slice(0,S+1)},N=e.computed(()=>!l.value||l.value.length===0?[]:o.expandStrategy==="firstLevel"?A(l.value,o.maxExpandCount):M(l.value,o.maxExpandCount)),z=e.computed(()=>o!=null&&o.model?w(o.model):[]);return e.watch(z,c=>{l.value=JSON.parse(JSON.stringify(c))},{immediate:!0}),(c,S)=>{const g=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(g,{data:l.value,props:f,"default-expanded-keys":N.value,"node-key":je,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},Ue=ne._export_sfc(Ie,[["__scopeId","data-v-290ff4e1"]]),Be={class:"panel-content"},Fe={key:0,class:"joints-list"},Ye={class:"joint-info-row"},He={class:"joint-left"},Ze={class:"joint-name"},Ke={class:"joint-range"},$e={class:"joint-type"},Ge={key:0,class:"joint-control-row"},Xe={class:"slider-container"},Je=["min","max","value","onInput","disabled"],qe={class:"value-display"},We={class:"joint-value"},Qe={class:"unit"},et={key:1,class:"empty-state"},ce=.001,tt=1e3,he=60,ot={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(a,{expose:t}){const o=a;e.ref(!0);const s=e.ref([]),l=e.ref(null),f=e.ref(12.5),_=e.ref();e.ref(1302);const r=e.ref(!1),w=e.ref(!1),M=e.ref(0),A=e.ref(0),N=e.ref(null),z=i.MathUtils.degToRad,c=e.ref(1),S=()=>tt/he/c.value;let g=[];e.watch(()=>o.animationData,y=>{var m;let P=((m=fe.cloneDeep(y))==null?void 0:m.动画输出)??[];P&&P.length>0&&(g=P,p())},{deep:!0});const n=e.computed(()=>g.length>0),d=(y,P=!1)=>y==="revolute"?P?Math.PI:-Math.PI:y==="prismatic"?P?1:-1:0,b=y=>{if(!y||!y.joints)return console.warn("URDF模型没有关节信息"),[];let P=null;if(y.traverse(x=>{x.name==="Pipe_Link"&&!P&&(P=x)}),P)_.value=P;else return console.warn("未找到管子模型"),[];const m=[];return Object.keys(y.joints).forEach(x=>{const v=y.joints[x];if(v._jointType==="fixed")return;const j=v.limit?{lower:v.limit.lower??d(v._jointType,!1),upper:v.limit.upper??d(v._jointType,!0)}:{lower:d(v._jointType,!1),upper:d(v._jointType,!0)};m.push({name:x,type:v._jointType||"unknown",limit:j,currentValue:v.angle||0,urdfJoint:v})}),m.sort((x,v)=>x.name.localeCompare(v.name))},C=(y,P)=>{const m=s.value.find(v=>v.name===y);if(!m)return;const x=parseFloat(P);if(m.limit){const v=Math.max(m.limit.lower,Math.min(m.limit.upper,x));m.currentValue=v}else m.currentValue=x;o.model&&o.model.setJointValue?o.model.setJointValue(y,m.currentValue):m.urdfJoint&&m.urdfJoint.setJointValue(m.currentValue)},U=y=>{if(!_.value||!n.value)return;const P=g.slice(0,y+1),m=[];let x=new i.Vector3(0,0,0),v=new i.Vector3(0,1,0),j=new i.Vector3(1,0,0);m.push(x.clone());for(const F of P){const $=F.Y??0,te=F.B??0,oe=F.C??0,V=F.R??0;if(te!==0){const u=new i.Matrix4().makeRotationAxis(v,z(te));j.applyMatrix4(u)}if($>0){const u=v.clone().multiplyScalar($*ce);x.add(u),m.push(x.clone())}if(oe>0&&V>0){const u=z(oe),G=V*ce,W=Math.max(16,Math.ceil(oe/5)),Q=x.clone().add(j.clone().multiplyScalar(-G));for(let q=1;q<=W;q++){const D=q/W,J=u*D,se=new i.Matrix4().makeRotationAxis(v.clone().cross(j).normalize(),J),ie=x.clone().sub(Q);ie.applyMatrix4(se);const de=Q.clone().add(ie);m.push(de),x.copy(de)}const ee=new i.Matrix4().makeRotationAxis(v.clone().cross(j).normalize(),u);j.applyMatrix4(ee)}}m.length<2&&m.push(new i.Vector3(0,.001,0));try{const F=new i.CatmullRomCurve3(m),$=new i.TubeGeometry(F,Math.max(2,m.length*4),f.value*ce,18,!1);_.value.geometry&&_.value.geometry.dispose(),_.value.geometry=$}catch(F){console.error("更新管子几何体失败:",F)}},B=y=>{y&&(Object.keys(y).forEach((P,m)=>{const x=y[P],v=s.value.find(j=>j.name===P);v&&(v.currentValue=x,o.model&&o.model.setJointValue?o.model.setJointValue(P,x):v.urdfJoint&&v.urdfJoint.setJointValue(x))}),console.log(232,index),U(index))},O=(y,P,m)=>y+(P-y)*m,I=(y,P,m)=>{if(!y||!P)return y||P;const x={};return Object.keys(y).forEach(v=>{const j=y[v],F=P[v];x[v]=O(j,F||j,m)}),x},p=()=>{if(g.length===0){console.warn("没有动画数据");return}r.value=!0,w.value=!1;const y=()=>{if(!r.value||w.value)return;const P=A.value/he,m=g[M.value],x=g[M.value+1];if(x){const v=I(m,x,P);B(v)}else B(m);if(A.value++,A.value>=he&&(A.value=0,M.value++,M.value>=g.length-1)){E();return}N.value=setTimeout(y,S())};y()},h=()=>{w.value=!0,N.value&&(clearTimeout(N.value),N.value=null)},E=()=>{r.value=!1,w.value=!1,c.value=1,N.value&&(clearTimeout(N.value),N.value=null)};t({startAnimation:p,pauseAnimation:h,stopAnimation:E,resetAll:()=>{E(),M.value=0,A.value=0,s.value.forEach(y=>{(y.type==="revolute"||y.type==="prismatic")&&C(y.name,0)})},fastForward:()=>{c.value<4&&(c.value=Math.min(4,c.value*2))},fastBackward:()=>{c.value>.25&&(c.value=Math.max(.25,c.value/2))}}),e.watch(()=>o.model,y=>{y?s.value=b(y):s.value=[]},{immediate:!0});const K=()=>{!o.model||r.value&&!w.value||s.value.forEach(y=>{y.urdfJoint&&y.urdfJoint.angle!==void 0&&(y.currentValue=y.urdfJoint.angle)})},X=()=>{const y=()=>{K(),l.value=requestAnimationFrame(y)};y()},le=()=>{l.value&&(cancelAnimationFrame(l.value),l.value=null)};return e.onMounted(()=>{X()}),e.onUnmounted(()=>{le(),E()}),(y,P)=>(e.openBlock(),e.createElementBlock("div",Be,[s.value.length>0?(e.openBlock(),e.createElementBlock("div",Fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,m=>{var x,v,j,F;return e.openBlock(),e.createElementBlock("div",{key:m.name,class:"joint-item"},[e.createElementVNode("div",Ye,[e.createElementVNode("div",He,[e.createElementVNode("span",Ze,e.toDisplayString(m.name),1),e.createElementVNode("span",Ke," ["+e.toDisplayString(((x=m.limit)==null?void 0:x.lower.toFixed(2))??(m.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((v=m.limit)==null?void 0:v.upper.toFixed(2))??(m.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",$e,e.toDisplayString(m.type),1)]),m.type==="revolute"||m.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",Xe,[e.createElementVNode("input",{type:"range",min:((j=m.limit)==null?void 0:j.lower)??(m.type==="revolute"?-Math.PI:-1),max:((F=m.limit)==null?void 0:F.upper)??(m.type==="revolute"?Math.PI:1),step:.01,value:m.currentValue,onInput:$=>C(m.name,$.target.value),class:"joint-slider",disabled:r.value&&!w.value},null,40,Je)]),e.createElementVNode("div",qe,[e.createElementVNode("span",We,e.toDisplayString(m.currentValue.toFixed(3)),1),e.createElementVNode("span",Qe,e.toDisplayString(m.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",et,P[0]||(P[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},it=ne._export_sfc(ot,[["__scopeId","data-v-64bf81e0"]]),nt=["xlink:href"],st=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})),s=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>{const{size:f}=t;let _=`${f}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(f,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:f.active}]),style:e.normalizeStyle(o.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[f.$attrs.class,f.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(l.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":s.value},null,8,nt)],6))],6))}}),T=ne._export_sfc(st,[["__scopeId","data-v-3150a90b"]]),at={class:"obj-viewer-container"},lt={class:"buttonGroup-top"},rt={class:"buttonGroup-topLeft"},ct={class:"buttonGroup-left"},ht={class:"buttonGroup-right"},ut={class:"buttonGroup-bottom"},dt={class:"left-panel"},pt={class:"panel-header"},mt={key:1,class:"clipping-content"},ft={class:"radio-group"},_t={class:"radio-label"},gt={class:"radio-label"},yt={class:"radio-label"},vt={class:"radio-label"},bt={class:"right-panel"},wt={class:"panel-header"},Et={key:0,class:"loading-overlay"},Pt={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(a,{expose:t,emit:o}){const s=o,l=a;let f=null,_=!1;const r=e.ref(null),w=e.ref(!1),M=e.ref("");e.ref(!1);const A=e.ref(!1),N=e.ref(!1),z=e.ref(""),c=e.ref(!1),S=e.ref(""),g=e.ref(),{currentModels:n,initialCameraPosition:d,initialTargetPosition:b,initThreeJS:C,handleResize:U,fitCameraToAllModels:B,getThreeJSObjects:O,clearAllModels:I,cleanup:p}=Ce(r),{isAnimating:h,toggleAnimation:E,stopAnimation:Y}=Ae(O,n),{isClipping:Z,activeClippingAxis:R,toggleClipping:K,updateClippingPlanes:X}=Ne(O,n),{addModelsFromUrls:le,loadModelByDefaultPath:y,urdfModel:P}=i.useModelLoader(O,n,w,M,I),m=()=>{if(A.value||n.value.length===0)return;A.value=!0,h.value&&Y();const{camera:V,controls:u}=O();if(!V||!u)return;u.enabled=!0;const G=J=>J<.5?4*J*J*J:1-Math.pow(-2*J+2,3)/2,W=V.position.clone(),Q=u.target.clone(),ee=1500,q=Date.now(),D=()=>{const J=Date.now()-q,se=Math.min(J/ee,1),ie=G(se);V.position.lerpVectors(W,d.value,ie),u.target.lerpVectors(Q,b.value,ie),se<1?requestAnimationFrame(D):A.value=!1};D()},x=async()=>_?Promise.resolve():new Promise(V=>{const u=()=>{_?V():requestAnimationFrame(u)};u()}),v=async(V,u)=>{try{await x(),h.value&&Y(),Z.value&&K();const G=await u(V);return B(),G}catch(G){throw console.error("加载模型失败:",G),G}},j=async V=>v(V,le),F=async V=>v(V,y),$=V=>{N.value=!0,z.value=V,V==="剖面视图"&&!Z.value&&K()},te=V=>{c.value=!0,S.value=V},oe=()=>{s("getAnimationData"),e.nextTick(()=>{var V;(V=g.value)==null||V.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{C(),f=O().scene,_=!0,window.addEventListener("resize",U)}catch(V){console.error("Three.js初始化失败:",V)}}),e.onBeforeUnmount(()=>{_=!1,z.value="",S.value="",window.removeEventListener("resize",U),h.value&&Y(),p()}),t({addModelsFromUrls:j,loadModelByDefaultPath:F}),(V,u)=>{var W,Q,ee,q;const G=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",lt,[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",rt,[e.createVNode(T,{name:"viewReset",size:"24",onClick:m,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(E),title:e.unref(h)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",ct,[e.createVNode(T,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=D=>$("场景树")),active:N.value&&z.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(T,{name:"clipping",size:"24",onClick:u[1]||(u[1]=D=>$("剖面视图")),active:N.value&&z.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(T,{name:"donghuafangzhen",size:"24",onClick:u[2]||(u[2]=D=>$("场景树3"))}),e.createVNode(T,{name:"donghuafangzhen",size:"24",onClick:u[3]||(u[3]=D=>$("场景4"))})]),e.createElementVNode("div",ht,[e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"guanjiekongzhi",size:"24",onClick:u[4]||(u[4]=D=>te("关节控制")),active:c.value&&S.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(T,{name:"DongHuaFangZhen",size:"24",title:"动画仿真",onClick:u[5]||(u[5]=D=>te("动画仿真")),active:c.value&&S.value==="动画仿真"},null,8,["active"]),e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",ut,[e.createVNode(T,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(W=g.value)==null?void 0:W.fastBackward},null,8,["onClick"]),e.createVNode(T,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:oe}),e.createVNode(T,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(Q=g.value)==null?void 0:Q.fastForward},null,8,["onClick"]),e.createVNode(T,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(ee=g.value)==null?void 0:ee.pauseAnimation},null,8,["onClick"]),e.createVNode(T,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(q=g.value)==null?void 0:q.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",dt,[e.createElementVNode("div",pt,[e.createElementVNode("span",null,e.toDisplayString(z.value),1),e.createElementVNode("span",{class:"close",onClick:u[6]||(u[6]=D=>N.value=!1)}," X ")]),e.createVNode(G,{"max-height":"650px"},{default:e.withCtx(()=>[z.value==="场景树"?(e.openBlock(),e.createBlock(Ue,{key:0,model:e.unref(P)},null,8,["model"])):e.createCommentVNode("",!0),z.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ft,[e.createElementVNode("label",_t,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":u[7]||(u[7]=D=>e.isRef(R)?R.value=D:null),onChange:u[8]||(u[8]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[16]||(u[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",gt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":u[9]||(u[9]=D=>e.isRef(R)?R.value=D:null),onChange:u[10]||(u[10]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[17]||(u[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",yt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":u[11]||(u[11]=D=>e.isRef(R)?R.value=D:null),onChange:u[12]||(u[12]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[18]||(u[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",vt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":u[13]||(u[13]=D=>e.isRef(R)?R.value=D:null),onChange:u[14]||(u[14]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[19]||(u[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,N.value]]),e.withDirectives(e.createElementVNode("div",bt,[e.createElementVNode("div",wt,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:u[15]||(u[15]=D=>c.value=!1)}," X ")]),e.createVNode(G,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(it,{ref_key:"jointRef",ref:g,model:e.unref(P),scene:e.unref(f),animationData:l==null?void 0:l.animationData},null,8,["model","scene","animationData"]),[[e.vShow,S.value==="关节控制"]]),e.withDirectives(e.createVNode(Oe,{animationData:l==null?void 0:l.animationData},null,8,["animationData"]),[[e.vShow,S.value==="动画仿真"]])]),_:1})],512),[[e.vShow,c.value]]),w.value?(e.openBlock(),e.createElementBlock("div",Et,[u[20]||(u[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(M.value),1)])):e.createCommentVNode("",!0)])}}},Mt=ne._export_sfc(Pt,[["__scopeId","data-v-14112288"]]);exports.default=Mt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),i=require("./index-BXdjo_xA.cjs"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),fe=require("./menu-DYsWoy6Z.cjs"),pe={type:"change"},ue={type:"start"},_e={type:"end"},ae=new i.Ray,me=new i.Plane,ge=Math.cos(70*i.MathUtils.DEG2RAD),L=new i.Vector3,H=2*Math.PI,k={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},re=1e-6;class ye extends i.Controls{constructor(t,o=null){super(t,o),this.state=k.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=be.bind(this),this._onPointerDown=ve.bind(this),this._onPointerUp=we.bind(this),this._onContextMenu=Se.bind(this),this._onMouseWheel=Me.bind(this),this._onKeyDown=xe.bind(this),this._onTouchStart=De.bind(this),this._onTouchMove=ke.bind(this),this._onMouseDown=Ee.bind(this),this._onMouseMove=Pe.bind(this),this._interceptControlDown=Ve.bind(this),this._interceptControlUp=Te.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(pe),this.update(),this.state=k.NONE}update(t=null){const o=this.object.position;L.copy(o).sub(this.target),L.applyQuaternion(this._quat),this._spherical.setFromVector3(L),this.autoRotate&&this.state===k.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 s=this.minAzimuthAngle,l=this.maxAzimuthAngle;isFinite(s)&&isFinite(l)&&(s<-Math.PI?s+=H:s>Math.PI&&(s-=H),l<-Math.PI?l+=H:l>Math.PI&&(l-=H),s<=l?this._spherical.theta=Math.max(s,Math.min(l,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+l)/2?Math.max(s,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 f=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const _=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),f=_!=this._spherical.radius}if(L.setFromSpherical(this._spherical),L.applyQuaternion(this._quatInverse),o.copy(this.target).add(L),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 _=null;if(this.object.isPerspectiveCamera){const r=L.length();_=this._clampDistance(r*this._scale);const b=r-_;this.object.position.addScaledVector(this._dollyDirection,b),this.object.updateMatrixWorld(),f=!!b}else if(this.object.isOrthographicCamera){const r=new i.Vector3(this._mouse.x,this._mouse.y,0);r.unproject(this.object);const b=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),f=b!==this.object.zoom;const E=new i.Vector3(this._mouse.x,this._mouse.y,0);E.unproject(this.object),this.object.position.sub(E).add(r),this.object.updateMatrixWorld(),_=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;_!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(_).add(this.object.position):(ae.origin.copy(this.object.position),ae.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ae.direction))<ge?this.object.lookAt(this.target):(me.setFromNormalAndCoplanarPoint(this.object.up,this.target),ae.intersectPlane(me,this.target))))}else if(this.object.isOrthographicCamera){const _=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),_!==this.object.zoom&&(this.object.updateProjectionMatrix(),f=!0)}return this._scale=1,this._performCursorZoom=!1,f||this._lastPosition.distanceToSquared(this.object.position)>re||8*(1-this._lastQuaternion.dot(this.object.quaternion))>re||this._lastTargetPosition.distanceToSquared(this.target)>re?(this.dispatchEvent(pe),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?H/60*this.autoRotateSpeed*t:H/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){L.setFromMatrixColumn(o,0),L.multiplyScalar(-t),this._panOffset.add(L)}_panUp(t,o){this.screenSpacePanning===!0?L.setFromMatrixColumn(o,1):(L.setFromMatrixColumn(o,0),L.crossVectors(this.object.up,L)),L.multiplyScalar(t),this._panOffset.add(L)}_pan(t,o){const s=this.domElement;if(this.object.isPerspectiveCamera){const l=this.object.position;L.copy(l).sub(this.target);let f=L.length();f*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*f/s.clientHeight,this.object.matrix),this._panUp(2*o*f/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(o*(this.object.top-this.object.bottom)/this.object.zoom/s.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 s=this.domElement.getBoundingClientRect(),l=t-s.left,f=o-s.top,_=s.width,r=s.height;this._mouse.x=l/_*2-1,this._mouse.y=-(f/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(H*this._rotateDelta.x/o.clientHeight),this._rotateUp(H*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(H*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(-H*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(H*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(-H*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),s=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._rotateStart.set(s,l)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const o=this._getSecondPointerPosition(t),s=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panStart.set(s,l)}}_handleTouchStartDolly(t){const o=this._getSecondPointerPosition(t),s=t.pageX-o.x,l=t.pageY-o.y,f=Math.sqrt(s*s+l*l);this._dollyStart.set(0,f)}_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 s=this._getSecondPointerPosition(t),l=.5*(t.pageX+s.x),f=.5*(t.pageY+s.y);this._rotateEnd.set(l,f)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const o=this.domElement;this._rotateLeft(H*this._rotateDelta.x/o.clientHeight),this._rotateUp(H*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),s=.5*(t.pageX+o.x),l=.5*(t.pageY+o.y);this._panEnd.set(s,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),s=t.pageX-o.x,l=t.pageY-o.y,f=Math.sqrt(s*s+l*l);this._dollyEnd.set(0,f),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 _=(t.pageX+o.x)*.5,r=(t.pageY+o.y)*.5;this._updateZoomParameters(_,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,s={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(o){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function ve(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 be(a){this.enabled!==!1&&(a.pointerType==="touch"?this._onTouchMove(a):this._onMouseMove(a))}function we(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(_e),this.state=k.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 Ee(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=k.DOLLY;break;case i.MOUSE.ROTATE:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=k.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=k.ROTATE}break;case i.MOUSE.PAN:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=k.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=k.PAN}break;default:this.state=k.NONE}this.state!==k.NONE&&this.dispatchEvent(ue)}function Pe(a){switch(this.state){case k.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(a);break;case k.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(a);break;case k.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(a);break}}function Me(a){this.enabled===!1||this.enableZoom===!1||this.state!==k.NONE||(a.preventDefault(),this.dispatchEvent(ue),this._handleMouseWheel(this._customWheelEvent(a)),this.dispatchEvent(_e))}function xe(a){this.enabled!==!1&&this._handleKeyDown(a)}function De(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=k.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(a),this.state=k.TOUCH_PAN;break;default:this.state=k.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=k.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(a),this.state=k.TOUCH_DOLLY_ROTATE;break;default:this.state=k.NONE}break;default:this.state=k.NONE}this.state!==k.NONE&&this.dispatchEvent(ue)}function ke(a){switch(this._trackPointer(a),this.state){case k.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(a),this.update();break;case k.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(a),this.update();break;case k.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(a),this.update();break;case k.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(a),this.update();break;default:this.state=k.NONE}}function Se(a){this.enabled!==!1&&a.preventDefault()}function Ve(a){a.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Te(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,s=null,l=null,f=null,_=null,r=null,b=null;const E=e.ref([]),A=e.ref(new i.Vector3),N=e.ref(new i.Vector3),z=()=>{if(!a.value)return;t=new i.Scene,t.background=new i.Color(15790320);const m=a.value;o=new i.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),o.position.set(8,-8,6),o.up.set(0,0,1),o.lookAt(0,0,0),s=new i.WebGLRenderer({antialias:!0,alpha:!0}),s.setSize(m.clientWidth,m.clientHeight),s.localClippingEnabled=!0,s.shadowMap.enabled=!0,s.shadowMap.type=i.PCFSoftShadowMap,s.toneMapping=i.ACESFilmicToneMapping,s.toneMappingExposure=1,s.outputColorSpace=i.SRGBColorSpace,m.appendChild(s.domElement),l=new ye(o,s.domElement),l.enableDamping=!0,l.dampingFactor=.05,l.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.PAN,RIGHT:null},l.panSpeed=.7,f=new i.Xe(o,s,{container:m,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"}}),f.attachControls(l),g(),n()},c=(m,h)=>{r&&(t.remove(r),r.dispose()),b&&(t.remove(b),b.geometry.dispose(),b.material.dispose());const P=Math.min(Math.max(Math.floor(m/20),30),40);r=new i.GridHelper(m,P,13421772,14540253),r.rotateX(Math.PI/2),r.position.copy(h),t.add(r);const Y=new i.PlaneGeometry(m,m),Z=new i.ShadowMaterial({opacity:.3,color:0});b=new i.Mesh(Y,Z),b.position.copy(h),b.position.z-=.01,b.receiveShadow=!0,t.add(b)},S=()=>{if(E.value.length===0)return;const m=new i.Box3;E.value.forEach(K=>{m.expandByObject(K)});const h=m.getSize(new i.Vector3),P=m.getCenter(new i.Vector3),Y=Math.max(h.x,h.y,h.z),Z=Math.max(Y*8,50),R=new i.Vector3(P.x,P.y,m.min.z);c(Z,R)},g=()=>{const m=new i.AmbientLight(4210752,.6);t.add(m);const h=new i.DirectionalLight(16777215,2);h.position.set(10,10,8),h.castShadow=!0,h.shadow.mapSize.width=4096,h.shadow.mapSize.height=4096,h.shadow.camera.near=.5,h.shadow.camera.far=50,h.shadow.camera.left=-50,h.shadow.camera.right=50,h.shadow.camera.top=50,h.shadow.camera.bottom=-50,t.add(h);const P=new i.DirectionalLight(16777215,.8);P.position.set(-8,-8,6),t.add(P);const Y=new i.DirectionalLight(16777215,.6);Y.position.set(0,-15,2),t.add(Y);const Z=new i.HemisphereLight(16777215,4473924,.8);t.add(Z);const R=new i.PointLight(16777215,1,50);R.position.set(15,15,15),t.add(R);const K=new i.PointLight(16777215,.5,50);K.position.set(-15,-15,15),t.add(K)},n=()=>{_=requestAnimationFrame(n),l&&l.update(),s&&t&&o&&s.render(t,o),f&&f.render()},p=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(P=>{m[P]&&m[P].dispose&&m[P].dispose()}),m.dispose&&m.dispose()},v=m=>{m==null||m.traverse(h=>{h.geometry&&h.geometry.dispose(),h.material&&(Array.isArray(h.material)?h.material.forEach(P=>{p(P)}):p(h.material))})};return{currentModels:E,initialCameraPosition:A,initialTargetPosition:N,initThreeJS:z,handleResize:()=>{if(!a.value||!o||!s||!f)return;const m=a.value,h=m.clientWidth,P=m.clientHeight;o.aspect=h/P,o.updateProjectionMatrix(),s.setSize(h,P),f.update()},fitCameraToAllModels:()=>{if(!o||!l||E.value.length===0)return;const m=new i.Box3;E.value.forEach(K=>{m.expandByObject(K)});const h=m.getSize(new i.Vector3),P=m.getCenter(new i.Vector3),Z=Math.max(h.x,h.y,h.z)*.8,R=new i.Vector3(P.x+Z,P.y-Z,P.z+Z);o.position.copy(R),o.lookAt(P),l.target.copy(P),l.update(),A.value.copy(R),N.value.copy(P),S()},getThreeJSObjects:()=>({scene:t,camera:o,renderer:s,controls:l,gizmo:f}),clearAllModels:()=>{if(!t)return;E.value.forEach(h=>{t.remove(h),v(h)});const m=[];t.children.forEach(h=>{!h.isLight&&!h.isCamera&&h.type!=="GridHelper"&&h!==b&&m.push(h)}),m.forEach(h=>{t.remove(h),v(h)}),E.value=[],S()},cleanup:()=>{_&&cancelAnimationFrame(_),r&&r.dispose(),b&&(b.geometry.dispose(),b.material.dispose()),s&&s.dispose(),l&&l.dispose(),f&&f.dispose()},updateGridForModels:S}}function Ae(a,t){const o=e.ref(!1);let s=null,l=12700,f=new i.Vector3,_=new i.Vector3,r=new i.Vector3,b=0,E=null;const A=n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,N=n=>{const p=new i.Vector3,v=b*1.2,C=new i.Vector3(r.x+v,r.y,r.z),I=new i.Vector3(r.x,r.y+v,r.z),U=new i.Vector3(r.x,r.y-v,r.z);if(n<=.567){const j=n/.567*Math.PI*2;p.x=r.x+Math.cos(j)*v,p.z=r.z+Math.sin(j)*v,p.y=r.y}else if(n<=.724){const O=(n-.567)/.157,j=A(O);p.lerpVectors(C,I,j)}else if(n<=.881){const O=(n-.724)/.157,m=A(O)*Math.PI;p.x=r.x+Math.sin(m)*v,p.y=r.y+Math.cos(m)*v,p.z=r.z}else{const O=(n-.881)/.119,j=A(O);p.lerpVectors(U,f,j)}return p},z=()=>{const{camera:n,controls:p}=a();if(!n||!p)return;s||(s=Date.now());const v=Date.now()-s,C=Math.min(v/l,1);if(C>=1){S();return}const I=N(C);n.position.copy(I),n.lookAt(r),p.target.copy(r),E=requestAnimationFrame(z)},c=()=>{if(t.value.length===0)return;const{camera:n,controls:p}=a();if(!n||!p)return;f.copy(n.position),_.copy(p.target);const v=new i.Box3;t.value.forEach(h=>{v.expandByObject(h)});const C=v.getSize(new i.Vector3);r=v.getCenter(new i.Vector3),b=Math.max(C.x,C.y,C.z)*1.2;const I=new i.Vector3(r.x+b*1.2,r.y,r.z);p.enabled=!1;const U=n.position.clone(),O=1e3,j=Date.now(),m=()=>{const h=Date.now()-j,P=Math.min(h/O,1),Y=A(P);n.position.lerpVectors(U,I,Y),n.lookAt(r),p.target.copy(r),P<1?requestAnimationFrame(m):(o.value=!0,s=null,z())};m()},S=()=>{o.value=!1,s=null,E&&(cancelAnimationFrame(E),E=null);const{controls:n}=a();n&&(n.enabled=!0,n.target.copy(_))};return{isAnimating:o,toggleAnimation:()=>{if(o.value){o.value=!1,s=null,E&&(cancelAnimationFrame(E),E=null);const{camera:n,controls:p}=a();if(!n||!p)return;p.enabled=!0;const v=n.position.clone(),C=p.target.clone(),I=1500,U=Date.now(),O=()=>{const j=Date.now()-U,m=Math.min(j/I,1),h=A(m);n.position.lerpVectors(v,f,h),p.target.lerpVectors(C,_,h),m<1&&requestAnimationFrame(O)};O()}else c()},startAnimation:c,stopAnimation:S}}function Ne(a,t){const o=e.ref(!1),s=e.ref("none");let l=[],f=[],_=new i.Box3,r=new i.Vector3;const b=()=>{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)]},E=()=>{_.makeEmpty(),t.value.forEach(g=>{_.expandByObject(g)}),r=_.getCenter(new i.Vector3)},A=g=>{const n=_.getSize(new i.Vector3);let p,v,C;g==="x"?(p=new i.PlaneGeometry(n.z*1.2,n.y*1.2),v=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(0,Math.PI/2,0)):g==="y"?(p=new i.PlaneGeometry(n.x*1.2,n.z*1.2),v=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(Math.PI/2,0,0)):g==="z"&&(p=new i.PlaneGeometry(n.x*1.2,n.y*1.2),v=new i.Vector3(r.x,r.y,r.z),C=new i.Euler(0,0,0));const I=new i.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:i.DoubleSide,depthWrite:!1}),U=new i.Mesh(p,I);return U.position.copy(v),U.rotation.copy(C),U},N=()=>{if(z(),c(),s.value==="none")return;E();let g=null;if(s.value==="x"?(l[0].constant=-r.x,g=l[0]):s.value==="y"?(l[1].constant=-r.y,g=l[1]):s.value==="z"&&(l[2].constant=-r.z,g=l[2]),g){t.value.forEach(p=>{p.traverse(v=>{v.isMesh&&v.material&&(Array.isArray(v.material)?v.material.forEach(C=>{C.clippingPlanes=[g]}):v.material.clippingPlanes=[g])})});const{scene:n}=a();if(n){const p=A(s.value);n.add(p),f.push(p)}}},z=()=>{t.value.forEach(g=>{g.traverse(n=>{n.isMesh&&n.material&&(Array.isArray(n.material)?n.material.forEach(p=>{p.clippingPlanes=[]}):n.material.clippingPlanes=[])})})},c=()=>{const{scene:g}=a();g&&f.forEach(n=>{g.remove(n),n.geometry.dispose(),n.material.dispose()}),f=[]};return{isClipping:o,activeClippingAxis:s,toggleClipping:()=>{o.value=!o.value,o.value?(b(),t.value.length>0&&E()):(s.value="none",z(),c())},updateClippingPlanes:N,clearClippingPlanes:z,clearClippingMeshes:c}}const ze={class:"panel-content"},Re={__name:"animationTable",props:{animationData:Object,model:Object},setup(a){const t=a;e.ref();const o=e.ref();return e.watch(()=>[t==null?void 0:t.animationData],()=>{var l;let s=((l=fe.cloneDeep(t==null?void 0:t.animationData))==null?void 0:l.动画输出Content)??[];s&&(o.value=s)},{deep:!0,immediate:!0}),(s,l)=>{var f,_,r;return e.openBlock(),e.createElementBlock("div",ze,[(e.openBlock(),e.createBlock(i.ssTable,{itemData:(f=o.value)==null?void 0:f.compData,key:(_=o.value)==null?void 0:_.id,index:(r=o.value)==null?void 0:r.id,showHeader:!1},null,8,["itemData","index"]))])}}},Oe=ne._export_sfc(Re,[["__scopeId","data-v-02b89b4b"]]),Le={class:"panel-content"},je="id",Ie={__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,s=t,l=e.ref([]),f={children:"children",label:"label"},_=c=>{s("nodeClick",c)},r=(c,S=0)=>{const g=[];return Array.isArray(c)&&(c==null?void 0:c.length)>0&&c.forEach(n=>{if(!(n!=null&&n.isMesh)&&((n==null?void 0:n.type)==="URDFJoint"||(n==null?void 0:n.type)==="URDFLink")){const p={name:n==null?void 0:n.name,label:n==null?void 0:n.name,show:!0,level:S+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:r(n==null?void 0:n.children,S+1),path:n==null?void 0:n.name};g.push(p)}}),g},b=c=>c?[{name:c==null?void 0:c.name,label:c==null?void 0:c.name,show:!0,level:1,isPenultimate:!1,type:c==null?void 0:c.type,id:c==null?void 0:c.id,limit:(c==null?void 0:c.limit)??"",children:r(c==null?void 0:c.children,1),path:c==null?void 0:c.name}]:[],E=(c,S)=>{const g=[],n=[...c];for(;n.length>0&&g.length<S;){const p=n.shift();p.children&&p.children.length>0&&(g.push(p.id),n.push(...p.children))}return g},A=(c,S)=>{const g=[];return c.forEach(n=>{if(n.children&&n.children.length>0){g.push(n.id);const p=n.children.filter(v=>v.children&&v.children.length>0).slice(0,S).map(v=>v.id);g.push(...p)}}),g.slice(0,S+1)},N=e.computed(()=>!l.value||l.value.length===0?[]:o.expandStrategy==="firstLevel"?A(l.value,o.maxExpandCount):E(l.value,o.maxExpandCount)),z=e.computed(()=>o!=null&&o.model?b(o.model):[]);return e.watch(z,c=>{l.value=JSON.parse(JSON.stringify(c))},{immediate:!0}),(c,S)=>{const g=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(g,{data:l.value,props:f,"default-expanded-keys":N.value,"node-key":je,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},Ue=ne._export_sfc(Ie,[["__scopeId","data-v-290ff4e1"]]),Be={class:"panel-content"},Fe={key:0,class:"joints-list"},Ye={class:"joint-info-row"},He={class:"joint-left"},Ze={class:"joint-name"},Ke={class:"joint-range"},$e={class:"joint-type"},Ge={key:0,class:"joint-control-row"},Xe={class:"slider-container"},Je=["min","max","value","onInput","disabled"],qe={class:"value-display"},We={class:"joint-value"},Qe={class:"unit"},et={key:1,class:"empty-state"},ce=.001,tt=1e3,he=60,ot={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(a,{expose:t}){const o=a;e.ref(!0);const s=e.ref([]),l=e.ref(null),f=e.ref(12.5),_=e.ref();e.ref(1302);const r=e.ref(!1),b=e.ref(!1),E=e.ref(0),A=e.ref(0),N=e.ref(null),z=i.MathUtils.degToRad,c=e.ref(1),S=()=>tt/he/c.value;let g=[];e.watch(()=>o.animationData,y=>{var d;let M=((d=fe.cloneDeep(y))==null?void 0:d.动画输出)??[];M&&M.length>0&&(g=M,m())},{deep:!0});const n=e.computed(()=>g.length>0),p=(y,M=!1)=>y==="revolute"?M?Math.PI:-Math.PI:y==="prismatic"?M?1:-1:0,v=y=>{if(!y||!y.joints)return console.warn("URDF模型没有关节信息"),[];let M=null;if(y.traverse(x=>{x.name==="Pipe_Link"&&!M&&(M=x)}),M)_.value=M;else return console.warn("未找到管子模型"),[];const d=[];return Object.keys(y.joints).forEach(x=>{const w=y.joints[x];if(w._jointType==="fixed")return;const B=w.limit?{lower:w.limit.lower??p(w._jointType,!1),upper:w.limit.upper??p(w._jointType,!0)}:{lower:p(w._jointType,!1),upper:p(w._jointType,!0)};d.push({name:x,type:w._jointType||"unknown",limit:B,currentValue:w.angle||0,urdfJoint:w})}),d.sort((x,w)=>x.name.localeCompare(w.name))},C=(y,M)=>{const d=s.value.find(w=>w.name===y);if(!d)return;const x=parseFloat(M);if(d.limit){const w=Math.max(d.limit.lower,Math.min(d.limit.upper,x));d.currentValue=w}else d.currentValue=x;o.model&&o.model.setJointValue?o.model.setJointValue(y,d.currentValue):d.urdfJoint&&d.urdfJoint.setJointValue(d.currentValue)},I=y=>{if(!_.value||!n.value)return;const M=g.slice(0,y+1),d=[];let x=new i.Vector3(0,0,0),w=new i.Vector3(0,1,0),B=new i.Vector3(1,0,0);d.push(x.clone());for(const F of M){const $=F.Y??0,te=F.B??0,oe=F.C??0,V=F.R??0;if(te!==0){const u=new i.Matrix4().makeRotationAxis(w,z(te));B.applyMatrix4(u)}if($>0){const u=w.clone().multiplyScalar($*ce);x.add(u),d.push(x.clone())}if(oe>0&&V>0){const u=z(oe),G=V*ce,W=Math.max(16,Math.ceil(oe/5)),Q=x.clone().add(B.clone().multiplyScalar(-G));for(let q=1;q<=W;q++){const D=q/W,J=u*D,se=new i.Matrix4().makeRotationAxis(w.clone().cross(B).normalize(),J),ie=x.clone().sub(Q);ie.applyMatrix4(se);const de=Q.clone().add(ie);d.push(de),x.copy(de)}const ee=new i.Matrix4().makeRotationAxis(w.clone().cross(B).normalize(),u);B.applyMatrix4(ee)}}d.length<2&&d.push(new i.Vector3(0,.001,0));try{const F=new i.CatmullRomCurve3(d),$=new i.TubeGeometry(F,Math.max(2,d.length*4),f.value*ce,18,!1);_.value.geometry&&_.value.geometry.dispose(),_.value.geometry=$}catch(F){console.error("更新管子几何体失败:",F)}},U=y=>{y&&(Object.keys(y).forEach(M=>{const d=y[M],x=s.value.find(w=>w.name===M);x&&(x.currentValue=d,o.model&&o.model.setJointValue?o.model.setJointValue(M,d):x.urdfJoint&&x.urdfJoint.setJointValue(d))}),console.log(232,index),I(index))},O=(y,M,d)=>y+(M-y)*d,j=(y,M,d)=>{if(!y||!M)return y||M;const x={};return Object.keys(y).forEach(w=>{const B=y[w],F=M[w];x[w]=O(B,F||B,d)}),x},m=()=>{if(g.length===0){console.warn("没有动画数据");return}r.value=!0,b.value=!1;const y=()=>{if(!r.value||b.value)return;const M=A.value/he;E.value;const d=g[E.value],x=g[E.value+1];if(x){const w=j(d,x,M);U(w)}else U(d);if(A.value++,A.value>=he&&(A.value=0,E.value++,E.value>=g.length-1)){P();return}N.value=setTimeout(y,S())};y()},h=()=>{b.value=!0,N.value&&(clearTimeout(N.value),N.value=null)},P=()=>{r.value=!1,b.value=!1,c.value=1,N.value&&(clearTimeout(N.value),N.value=null)};t({startAnimation:m,pauseAnimation:h,stopAnimation:P,resetAll:()=>{P(),E.value=0,A.value=0,s.value.forEach(y=>{(y.type==="revolute"||y.type==="prismatic")&&C(y.name,0)})},fastForward:()=>{c.value<4&&(c.value=Math.min(4,c.value*2))},fastBackward:()=>{c.value>.25&&(c.value=Math.max(.25,c.value/2))}}),e.watch(()=>o.model,y=>{y?s.value=v(y):s.value=[]},{immediate:!0});const K=()=>{!o.model||r.value&&!b.value||s.value.forEach(y=>{y.urdfJoint&&y.urdfJoint.angle!==void 0&&(y.currentValue=y.urdfJoint.angle)})},X=()=>{const y=()=>{K(),l.value=requestAnimationFrame(y)};y()},le=()=>{l.value&&(cancelAnimationFrame(l.value),l.value=null)};return e.onMounted(()=>{X()}),e.onUnmounted(()=>{le(),P()}),(y,M)=>(e.openBlock(),e.createElementBlock("div",Be,[s.value.length>0?(e.openBlock(),e.createElementBlock("div",Fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>{var x,w,B,F;return e.openBlock(),e.createElementBlock("div",{key:d.name,class:"joint-item"},[e.createElementVNode("div",Ye,[e.createElementVNode("div",He,[e.createElementVNode("span",Ze,e.toDisplayString(d.name),1),e.createElementVNode("span",Ke," ["+e.toDisplayString(((x=d.limit)==null?void 0:x.lower.toFixed(2))??(d.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((w=d.limit)==null?void 0:w.upper.toFixed(2))??(d.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",$e,e.toDisplayString(d.type),1)]),d.type==="revolute"||d.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",Xe,[e.createElementVNode("input",{type:"range",min:((B=d.limit)==null?void 0:B.lower)??(d.type==="revolute"?-Math.PI:-1),max:((F=d.limit)==null?void 0:F.upper)??(d.type==="revolute"?Math.PI:1),step:.01,value:d.currentValue,onInput:$=>C(d.name,$.target.value),class:"joint-slider",disabled:r.value&&!b.value},null,40,Je)]),e.createElementVNode("div",qe,[e.createElementVNode("span",We,e.toDisplayString(d.currentValue.toFixed(3)),1),e.createElementVNode("span",Qe,e.toDisplayString(d.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",et,M[0]||(M[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},it=ne._export_sfc(ot,[["__scopeId","data-v-1d84cea4"]]),nt=["xlink:href"],st=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})),s=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>{const{size:f}=t;let _=`${f}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(f,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:f.active}]),style:e.normalizeStyle(o.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[f.$attrs.class,f.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(l.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":s.value},null,8,nt)],6))],6))}}),T=ne._export_sfc(st,[["__scopeId","data-v-3150a90b"]]),at={class:"obj-viewer-container"},lt={class:"buttonGroup-top"},rt={class:"buttonGroup-topLeft"},ct={class:"buttonGroup-left"},ht={class:"buttonGroup-right"},ut={class:"buttonGroup-bottom"},dt={class:"left-panel"},pt={class:"panel-header"},mt={key:1,class:"clipping-content"},ft={class:"radio-group"},_t={class:"radio-label"},gt={class:"radio-label"},yt={class:"radio-label"},vt={class:"radio-label"},bt={class:"right-panel"},wt={class:"panel-header"},Et={key:0,class:"loading-overlay"},Pt={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(a,{expose:t,emit:o}){const s=o,l=a;let f=null,_=!1;const r=e.ref(null),b=e.ref(!1),E=e.ref("");e.ref(!1);const A=e.ref(!1),N=e.ref(!1),z=e.ref(""),c=e.ref(!1),S=e.ref(""),g=e.ref(),{currentModels:n,initialCameraPosition:p,initialTargetPosition:v,initThreeJS:C,handleResize:I,fitCameraToAllModels:U,getThreeJSObjects:O,clearAllModels:j,cleanup:m}=Ce(r),{isAnimating:h,toggleAnimation:P,stopAnimation:Y}=Ae(O,n),{isClipping:Z,activeClippingAxis:R,toggleClipping:K,updateClippingPlanes:X}=Ne(O,n),{addModelsFromUrls:le,loadModelByDefaultPath:y,urdfModel:M}=i.useModelLoader(O,n,b,E,j),d=()=>{if(A.value||n.value.length===0)return;A.value=!0,h.value&&Y();const{camera:V,controls:u}=O();if(!V||!u)return;u.enabled=!0;const G=J=>J<.5?4*J*J*J:1-Math.pow(-2*J+2,3)/2,W=V.position.clone(),Q=u.target.clone(),ee=1500,q=Date.now(),D=()=>{const J=Date.now()-q,se=Math.min(J/ee,1),ie=G(se);V.position.lerpVectors(W,p.value,ie),u.target.lerpVectors(Q,v.value,ie),se<1?requestAnimationFrame(D):A.value=!1};D()},x=async()=>_?Promise.resolve():new Promise(V=>{const u=()=>{_?V():requestAnimationFrame(u)};u()}),w=async(V,u)=>{try{await x(),h.value&&Y(),Z.value&&K();const G=await u(V);return U(),G}catch(G){throw console.error("加载模型失败:",G),G}},B=async V=>w(V,le),F=async V=>w(V,y),$=V=>{N.value=!0,z.value=V,V==="剖面视图"&&!Z.value&&K()},te=V=>{c.value=!0,S.value=V},oe=()=>{s("getAnimationData"),e.nextTick(()=>{var V;(V=g.value)==null||V.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{C(),f=O().scene,_=!0,window.addEventListener("resize",I)}catch(V){console.error("Three.js初始化失败:",V)}}),e.onBeforeUnmount(()=>{_=!1,z.value="",S.value="",window.removeEventListener("resize",I),h.value&&Y(),m()}),t({addModelsFromUrls:B,loadModelByDefaultPath:F}),(V,u)=>{var W,Q,ee,q;const G=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",lt,[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",rt,[e.createVNode(T,{name:"viewReset",size:"24",onClick:d,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(P),title:e.unref(h)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",ct,[e.createVNode(T,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=D=>$("场景树")),active:N.value&&z.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(T,{name:"clipping",size:"24",onClick:u[1]||(u[1]=D=>$("剖面视图")),active:N.value&&z.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(T,{name:"donghuafangzhen",size:"24",onClick:u[2]||(u[2]=D=>$("场景树3"))}),e.createVNode(T,{name:"donghuafangzhen",size:"24",onClick:u[3]||(u[3]=D=>$("场景4"))})]),e.createElementVNode("div",ht,[e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"guanjiekongzhi",size:"24",onClick:u[4]||(u[4]=D=>te("关节控制")),active:c.value&&S.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(T,{name:"DongHuaFangZhen",size:"24",title:"动画仿真",onClick:u[5]||(u[5]=D=>te("动画仿真")),active:c.value&&S.value==="动画仿真"},null,8,["active"]),e.createVNode(T,{name:"donghuafangzhen",size:"24"}),e.createVNode(T,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",ut,[e.createVNode(T,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(W=g.value)==null?void 0:W.fastBackward},null,8,["onClick"]),e.createVNode(T,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:oe}),e.createVNode(T,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(Q=g.value)==null?void 0:Q.fastForward},null,8,["onClick"]),e.createVNode(T,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(ee=g.value)==null?void 0:ee.pauseAnimation},null,8,["onClick"]),e.createVNode(T,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(q=g.value)==null?void 0:q.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",dt,[e.createElementVNode("div",pt,[e.createElementVNode("span",null,e.toDisplayString(z.value),1),e.createElementVNode("span",{class:"close",onClick:u[6]||(u[6]=D=>N.value=!1)}," X ")]),e.createVNode(G,{"max-height":"650px"},{default:e.withCtx(()=>[z.value==="场景树"?(e.openBlock(),e.createBlock(Ue,{key:0,model:e.unref(M)},null,8,["model"])):e.createCommentVNode("",!0),z.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ft,[e.createElementVNode("label",_t,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":u[7]||(u[7]=D=>e.isRef(R)?R.value=D:null),onChange:u[8]||(u[8]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[16]||(u[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",gt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":u[9]||(u[9]=D=>e.isRef(R)?R.value=D:null),onChange:u[10]||(u[10]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[17]||(u[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",yt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":u[11]||(u[11]=D=>e.isRef(R)?R.value=D:null),onChange:u[12]||(u[12]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[18]||(u[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",vt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":u[13]||(u[13]=D=>e.isRef(R)?R.value=D:null),onChange:u[14]||(u[14]=(...D)=>e.unref(X)&&e.unref(X)(...D))},null,544),[[e.vModelRadio,e.unref(R)]]),u[19]||(u[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,N.value]]),e.withDirectives(e.createElementVNode("div",bt,[e.createElementVNode("div",wt,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:u[15]||(u[15]=D=>c.value=!1)}," X ")]),e.createVNode(G,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(it,{ref_key:"jointRef",ref:g,model:e.unref(M),scene:e.unref(f),animationData:l==null?void 0:l.animationData},null,8,["model","scene","animationData"]),[[e.vShow,S.value==="关节控制"]]),e.withDirectives(e.createVNode(Oe,{animationData:l==null?void 0:l.animationData},null,8,["animationData"]),[[e.vShow,S.value==="动画仿真"]])]),_:1})],512),[[e.vShow,c.value]]),b.value?(e.openBlock(),e.createElementBlock("div",Et,[u[20]||(u[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)])}}},Mt=ne._export_sfc(Pt,[["__scopeId","data-v-14112288"]]);exports.default=Mt;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ss-component-new",
3
3
  "private": false,
4
- "version": "1.1.586",
4
+ "version": "1.1.587",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",