ss-component-new 1.1.607 → 1.1.608
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-CV9GhHVQ.js → index-BgydVX0j.js} +1 -1
- package/dist/{index-BhfNBV_Y.cjs → index-CfJqgH7E.cjs} +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-BZkfaTio.cjs +1 -0
- package/dist/{threeModel-CGO5VFhW.js → threeModel-DTY2N9TB.js} +554 -551
- package/package.json +1 -1
- package/dist/threeModel-BFW_sW2p.cjs +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("./index-Cplpn8hS.cjs"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),fe=require("./menu-1olc0mrV.cjs"),pe={type:"change"},ue={type:"start"},_e={type:"end"},ne=new o.Ray,me=new o.Plane,ge=Math.cos(70*o.MathUtils.DEG2RAD),B=new o.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},ce=1e-6;class ye extends o.Controls{constructor(t,i=null){super(t,i),this.state=k.NONE,this.target=new o.Vector3,this.cursor=new o.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:o.MOUSE.ROTATE,MIDDLE:o.MOUSE.DOLLY,RIGHT:o.MOUSE.PAN},this.touches={ONE:o.TOUCH.ROTATE,TWO:o.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 o.Vector3,this._lastQuaternion=new o.Quaternion,this._lastTargetPosition=new o.Vector3,this._quat=new o.Quaternion().setFromUnitVectors(t.up,new o.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new o.Spherical,this._sphericalDelta=new o.Spherical,this._scale=1,this._panOffset=new o.Vector3,this._rotateStart=new o.Vector2,this._rotateEnd=new o.Vector2,this._rotateDelta=new o.Vector2,this._panStart=new o.Vector2,this._panEnd=new o.Vector2,this._panDelta=new o.Vector2,this._dollyStart=new o.Vector2,this._dollyEnd=new o.Vector2,this._dollyDelta=new o.Vector2,this._dollyDirection=new o.Vector3,this._mouse=new o.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=Ve.bind(this),this._onMouseDown=Ee.bind(this),this._onMouseMove=Pe.bind(this),this._interceptControlDown=ke.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 i=this.object.position;B.copy(i).sub(this.target),B.applyQuaternion(this._quat),this._spherical.setFromVector3(B),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 m=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const b=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),m=b!=this._spherical.radius}if(B.setFromSpherical(this._spherical),B.applyQuaternion(this._quatInverse),i.copy(this.target).add(B),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 b=null;if(this.object.isPerspectiveCamera){const r=B.length();b=this._clampDistance(r*this._scale);const x=r-b;this.object.position.addScaledVector(this._dollyDirection,x),this.object.updateMatrixWorld(),m=!!x}else if(this.object.isOrthographicCamera){const r=new o.Vector3(this._mouse.x,this._mouse.y,0);r.unproject(this.object);const x=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),m=x!==this.object.zoom;const M=new o.Vector3(this._mouse.x,this._mouse.y,0);M.unproject(this.object),this.object.position.sub(M).add(r),this.object.updateMatrixWorld(),b=B.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;b!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(b).add(this.object.position):(ne.origin.copy(this.object.position),ne.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ne.direction))<ge?this.object.lookAt(this.target):(me.setFromNormalAndCoplanarPoint(this.object.up,this.target),ne.intersectPlane(me,this.target))))}else if(this.object.isOrthographicCamera){const b=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),b!==this.object.zoom&&(this.object.updateProjectionMatrix(),m=!0)}return this._scale=1,this._performCursorZoom=!1,m||this._lastPosition.distanceToSquared(this.object.position)>ce||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ce||this._lastTargetPosition.distanceToSquared(this.target)>ce?(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 i=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*i)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,i){B.setFromMatrixColumn(i,0),B.multiplyScalar(-t),this._panOffset.add(B)}_panUp(t,i){this.screenSpacePanning===!0?B.setFromMatrixColumn(i,1):(B.setFromMatrixColumn(i,0),B.crossVectors(this.object.up,B)),B.multiplyScalar(t),this._panOffset.add(B)}_pan(t,i){const s=this.domElement;if(this.object.isPerspectiveCamera){const l=this.object.position;B.copy(l).sub(this.target);let m=B.length();m*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*m/s.clientHeight,this.object.matrix),this._panUp(2*i*m/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(i*(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,i){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const s=this.domElement.getBoundingClientRect(),l=t-s.left,m=i-s.top,b=s.width,r=s.height;this._mouse.x=l/b*2-1,this._mouse.y=-(m/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 i=this.domElement;this._rotateLeft(H*this._rotateDelta.x/i.clientHeight),this._rotateUp(H*this._rotateDelta.y/i.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 i=!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),i=!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),i=!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),i=!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),i=!0;break}i&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),s=.5*(t.pageX+i.x),l=.5*(t.pageY+i.y);this._rotateStart.set(s,l)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),s=.5*(t.pageX+i.x),l=.5*(t.pageY+i.y);this._panStart.set(s,l)}}_handleTouchStartDolly(t){const i=this._getSecondPointerPosition(t),s=t.pageX-i.x,l=t.pageY-i.y,m=Math.sqrt(s*s+l*l);this._dollyStart.set(0,m)}_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),m=.5*(t.pageY+s.y);this._rotateEnd.set(l,m)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const i=this.domElement;this._rotateLeft(H*this._rotateDelta.x/i.clientHeight),this._rotateUp(H*this._rotateDelta.y/i.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),s=.5*(t.pageX+i.x),l=.5*(t.pageY+i.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 i=this._getSecondPointerPosition(t),s=t.pageX-i.x,l=t.pageY-i.y,m=Math.sqrt(s*s+l*l);this._dollyEnd.set(0,m),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 b=(t.pageX+i.x)*.5,r=(t.pageY+i.y)*.5;this._updateZoomParameters(b,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 i=0;i<this._pointers.length;i++)if(this._pointers[i]==t.pointerId){this._pointers.splice(i,1);return}}_isTrackingPointer(t){for(let i=0;i<this._pointers.length;i++)if(this._pointers[i]==t.pointerId)return!0;return!1}_trackPointer(t){let i=this._pointerPositions[t.pointerId];i===void 0&&(i=new o.Vector2,this._pointerPositions[t.pointerId]=i),i.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const i=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[i]}_customWheelEvent(t){const i=t.deltaMode,s={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(i){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],i=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:i.x,pageY:i.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 o.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(a),this.state=k.DOLLY;break;case o.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 o.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 o.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(a),this.state=k.TOUCH_ROTATE;break;case o.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 o.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(a),this.state=k.TOUCH_DOLLY_PAN;break;case o.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 Ve(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 ke(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,i=null,s=null,l=null,m=null,b=null,r=null,x=null;const M=e.ref([]),C=e.ref(new o.Vector3),N=e.ref(new o.Vector3),O=()=>{if(!a.value)return;t=new o.Scene,t.background=new o.Color(15790320);const _=a.value;i=new o.PerspectiveCamera(75,_.clientWidth/_.clientHeight,.1,1e4),i.position.set(8,-8,6),i.up.set(0,0,1),i.lookAt(0,0,0),s=new o.WebGLRenderer({antialias:!0,alpha:!0}),s.setSize(_.clientWidth,_.clientHeight),s.localClippingEnabled=!0,s.shadowMap.enabled=!0,s.shadowMap.type=o.PCFSoftShadowMap,s.toneMapping=o.ACESFilmicToneMapping,s.toneMappingExposure=1,s.outputColorSpace=o.SRGBColorSpace,_.appendChild(s.domElement),l=new ye(i,s.domElement),l.enableDamping=!0,l.dampingFactor=.05,l.mouseButtons={LEFT:null,MIDDLE:o.MOUSE.PAN,RIGHT:o.MOUSE.ROTATE},l.panSpeed=.7,m=new o.Xe(i,s,{container:_,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"}}),m.attachControls(l),v(),n()},h=(_,p)=>{r&&(t.remove(r),r.dispose()),x&&(t.remove(x),x.geometry.dispose(),x.material.dispose());const D=Math.min(Math.max(Math.floor(_/20),30),40);r=new o.GridHelper(_,D,13421772,14540253),r.rotateX(Math.PI/2),r.position.copy(p),t.add(r);const U=new o.PlaneGeometry(_,_),T=new o.ShadowMaterial({opacity:.3,color:0});x=new o.Mesh(U,T),x.position.copy(p),x.position.z-=.01,x.receiveShadow=!0,t.add(x)},S=()=>{if(M.value.length===0)return;const _=new o.Box3;let p=!1;if(M.value.forEach(K=>{if(K.userData.boundingBox)_.union(K.userData.boundingBox),p=!0;else if(K.userData.modelId&&modelBoundingBoxes.has(K.userData.modelId)){const G=modelBoundingBoxes.get(K.userData.modelId);_.union(G.box),p=!0}else _.expandByObject(K),p=!0}),!p){console.warn("无法计算包围盒,网格更新失败");return}const D=_.getSize(new o.Vector3),U=_.getCenter(new o.Vector3),T=Math.max(D.x,D.y,D.z),W=Math.max(T*8,50),L=new o.Vector3(U.x,U.y,_.min.z);h(W,L)},v=()=>{const _=new o.AmbientLight(4210752,.6);t.add(_);const p=new o.DirectionalLight(16777215,2);p.position.set(10,10,8),p.castShadow=!0,p.shadow.mapSize.width=4096,p.shadow.mapSize.height=4096,p.shadow.camera.near=.5,p.shadow.camera.far=50,p.shadow.camera.left=-50,p.shadow.camera.right=50,p.shadow.camera.top=50,p.shadow.camera.bottom=-50,t.add(p);const D=new o.DirectionalLight(16777215,.8);D.position.set(-8,-8,6),t.add(D);const U=new o.DirectionalLight(16777215,.6);U.position.set(0,-15,2),t.add(U);const T=new o.HemisphereLight(16777215,4473924,.8);t.add(T);const W=new o.PointLight(16777215,1,50);W.position.set(15,15,15),t.add(W);const L=new o.PointLight(16777215,.5,50);L.position.set(-15,-15,15),t.add(L)},n=()=>{b=requestAnimationFrame(n),l&&l.update(),s&&t&&i&&s.render(t,i),m&&m.render()},f=_=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(D=>{_[D]&&_[D].dispose&&_[D].dispose()}),_.dispose&&_.dispose()},E=_=>{_==null||_.traverse(p=>{p.geometry&&p.geometry.dispose(),p.material&&(Array.isArray(p.material)?p.material.forEach(D=>{f(D)}):f(p.material))})};return{currentModels:M,initialCameraPosition:C,initialTargetPosition:N,initThreeJS:O,handleResize:()=>{if(!a.value||!i||!s||!m)return;const _=a.value,p=_.clientWidth,D=_.clientHeight;i.aspect=p/D,i.updateProjectionMatrix(),s.setSize(p,D),m.update()},fitCameraToAllModels:_=>{if(!i||!l||M.value.length===0)return;const p=new o.Box3;let D=!1;if(M.value.forEach(G=>{if(G.userData.boundingBox)p.union(G.userData.boundingBox),D=!0;else if(G.userData.modelId&&_.has(G.userData.modelId)){const oe=_.get(G.userData.modelId);p.union(oe.box),D=!0}else p.expandByObject(G),D=!0}),!D){console.warn("无法计算包围盒");return}const U=p.getSize(new o.Vector3),T=p.getCenter(new o.Vector3),L=Math.max(U.x,U.y,U.z)*.8,K=new o.Vector3(T.x+L,T.y-L,T.z+L);i.position.copy(K),i.lookAt(T),l.target.copy(T),l.update(),C.value.copy(K),N.value.copy(T),S()},getThreeJSObjects:()=>({scene:t,camera:i,renderer:s,controls:l,gizmo:m}),clearAllModels:()=>{if(!t)return;M.value.forEach(p=>{t.remove(p),E(p)});const _=[];t.children.forEach(p=>{!p.isLight&&!p.isCamera&&p.type!=="GridHelper"&&p!==x&&_.push(p)}),_.forEach(p=>{t.remove(p),E(p)}),M.value=[],S()},cleanup:()=>{b&&cancelAnimationFrame(b),r&&r.dispose(),x&&(x.geometry.dispose(),x.material.dispose()),s&&s.dispose(),l&&l.dispose(),m&&m.dispose()},updateGridForModels:S}}function Ae(a,t){const i=e.ref(!1);let s=null,l=12700,m=new o.Vector3,b=new o.Vector3,r=new o.Vector3,x=0,M=null;const C=n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,N=n=>{const f=new o.Vector3,E=x*1.2,R=new o.Vector3(r.x+E,r.y,r.z),Z=new o.Vector3(r.x,r.y+E,r.z),I=new o.Vector3(r.x,r.y-E,r.z);if(n<=.567){const Y=n/.567*Math.PI*2;f.x=r.x+Math.cos(Y)*E,f.z=r.z+Math.sin(Y)*E,f.y=r.y}else if(n<=.724){const F=(n-.567)/.157,Y=C(F);f.lerpVectors(R,Z,Y)}else if(n<=.881){const F=(n-.724)/.157,_=C(F)*Math.PI;f.x=r.x+Math.sin(_)*E,f.y=r.y+Math.cos(_)*E,f.z=r.z}else{const F=(n-.881)/.119,Y=C(F);f.lerpVectors(I,m,Y)}return f},O=()=>{const{camera:n,controls:f}=a();if(!n||!f)return;s||(s=Date.now());const E=Date.now()-s,R=Math.min(E/l,1);if(R>=1){S();return}const Z=N(R);n.position.copy(Z),n.lookAt(r),f.target.copy(r),M=requestAnimationFrame(O)},h=()=>{if(t.value.length===0)return;const{camera:n,controls:f}=a();if(!n||!f)return;m.copy(n.position),b.copy(f.target);const E=new o.Box3;t.value.forEach(p=>{E.expandByObject(p)});const R=E.getSize(new o.Vector3);r=E.getCenter(new o.Vector3),x=Math.max(R.x,R.y,R.z)*1.2;const Z=new o.Vector3(r.x+x*1.2,r.y,r.z);f.enabled=!1;const I=n.position.clone(),F=1e3,Y=Date.now(),_=()=>{const p=Date.now()-Y,D=Math.min(p/F,1),U=C(D);n.position.lerpVectors(I,Z,U),n.lookAt(r),f.target.copy(r),D<1?requestAnimationFrame(_):(i.value=!0,s=null,O())};_()},S=()=>{i.value=!1,s=null,M&&(cancelAnimationFrame(M),M=null);const{controls:n}=a();n&&(n.enabled=!0,n.target.copy(b))};return{isAnimating:i,toggleAnimation:()=>{if(i.value){i.value=!1,s=null,M&&(cancelAnimationFrame(M),M=null);const{camera:n,controls:f}=a();if(!n||!f)return;f.enabled=!0;const E=n.position.clone(),R=f.target.clone(),Z=1500,I=Date.now(),F=()=>{const Y=Date.now()-I,_=Math.min(Y/Z,1),p=C(_);n.position.lerpVectors(E,m,p),f.target.lerpVectors(R,b,p),_<1&&requestAnimationFrame(F)};F()}else h()},startAnimation:h,stopAnimation:S}}function Ne(a,t){const i=e.ref(!1),s=e.ref("none");let l=[],m=[],b=new o.Box3,r=new o.Vector3;const x=()=>{l=[new o.Plane(new o.Vector3(1,0,0),0),new o.Plane(new o.Vector3(0,1,0),0),new o.Plane(new o.Vector3(0,0,1),0)]},M=()=>{b.makeEmpty(),t.value.forEach(v=>{b.expandByObject(v)}),r=b.getCenter(new o.Vector3)},C=v=>{const n=b.getSize(new o.Vector3);let f,E,R;v==="x"?(f=new o.PlaneGeometry(n.z*1.2,n.y*1.2),E=new o.Vector3(r.x,r.y,r.z),R=new o.Euler(0,Math.PI/2,0)):v==="y"?(f=new o.PlaneGeometry(n.x*1.2,n.z*1.2),E=new o.Vector3(r.x,r.y,r.z),R=new o.Euler(Math.PI/2,0,0)):v==="z"&&(f=new o.PlaneGeometry(n.x*1.2,n.y*1.2),E=new o.Vector3(r.x,r.y,r.z),R=new o.Euler(0,0,0));const Z=new o.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:o.DoubleSide,depthWrite:!1}),I=new o.Mesh(f,Z);return I.position.copy(E),I.rotation.copy(R),I},N=()=>{if(O(),h(),s.value==="none")return;M();let v=null;if(s.value==="x"?(l[0].constant=-r.x,v=l[0]):s.value==="y"?(l[1].constant=-r.y,v=l[1]):s.value==="z"&&(l[2].constant=-r.z,v=l[2]),v){t.value.forEach(f=>{f.traverse(E=>{E.isMesh&&E.material&&(Array.isArray(E.material)?E.material.forEach(R=>{R.clippingPlanes=[v]}):E.material.clippingPlanes=[v])})});const{scene:n}=a();if(n){const f=C(s.value);n.add(f),m.push(f)}}},O=()=>{t.value.forEach(v=>{v.traverse(n=>{n.isMesh&&n.material&&(Array.isArray(n.material)?n.material.forEach(f=>{f.clippingPlanes=[]}):n.material.clippingPlanes=[])})})},h=()=>{const{scene:v}=a();v&&m.forEach(n=>{v.remove(n),n.geometry.dispose(),n.material.dispose()}),m=[]};return{isClipping:i,activeClippingAxis:s,toggleClipping:()=>{i.value=!i.value,i.value?(x(),t.value.length>0&&M()):(s.value="none",O(),h())},updateClippingPlanes:N,clearClippingPlanes:O,clearClippingMeshes:h}}const Re={class:"panel-content"},ze={__name:"animationTable",props:{animationData:Object,model:Object},setup(a){const t=a;e.ref();const i=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&&(i.value=s)},{deep:!0,immediate:!0}),(s,l)=>{var m,b,r;return e.openBlock(),e.createElementBlock("div",Re,[(e.openBlock(),e.createBlock(o.ssTable,{itemData:(m=i.value)==null?void 0:m.compData,key:(b=i.value)==null?void 0:b.id,index:(r=i.value)==null?void 0:r.id,showHeader:!1},null,8,["itemData","index"]))])}}},Oe=ie._export_sfc(ze,[["__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 i=a,s=t,l=e.ref([]),m={children:"children",label:"label"},b=h=>{s("nodeClick",h)},r=(h,S=0)=>{const v=[];return Array.isArray(h)&&(h==null?void 0:h.length)>0&&h.forEach(n=>{if(!(n!=null&&n.isMesh)&&((n==null?void 0:n.type)==="URDFJoint"||(n==null?void 0:n.type)==="URDFLink")){const f={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};v.push(f)}}),v},x=h=>h?[{name:h==null?void 0:h.name,label:h==null?void 0:h.name,show:!0,level:1,isPenultimate:!1,type:h==null?void 0:h.type,id:h==null?void 0:h.id,limit:(h==null?void 0:h.limit)??"",children:r(h==null?void 0:h.children,1),path:h==null?void 0:h.name}]:[],M=(h,S)=>{const v=[],n=[...h];for(;n.length>0&&v.length<S;){const f=n.shift();f.children&&f.children.length>0&&(v.push(f.id),n.push(...f.children))}return v},C=(h,S)=>{const v=[];return h.forEach(n=>{if(n.children&&n.children.length>0){v.push(n.id);const f=n.children.filter(E=>E.children&&E.children.length>0).slice(0,S).map(E=>E.id);v.push(...f)}}),v.slice(0,S+1)},N=e.computed(()=>!l.value||l.value.length===0?[]:i.expandStrategy==="firstLevel"?C(l.value,i.maxExpandCount):M(l.value,i.maxExpandCount)),O=e.computed(()=>i!=null&&i.model?x(i.model):[]);return e.watch(O,h=>{l.value=JSON.parse(JSON.stringify(h))},{immediate:!0}),(h,S)=>{const v=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(v,{data:l.value,props:m,"default-expanded-keys":N.value,"node-key":je,onNodeClick:b},null,8,["data","default-expanded-keys"])])}}},Be=ie._export_sfc(Ie,[["__scopeId","data-v-fde9ea18"]]),Ue={class:"panel-content"},Fe={key:0,class:"joints-list"},Ye={class:"joint-info-row"},Ze={class:"joint-left"},He={class:"joint-name"},Ke={class:"joint-range"},Xe={class:"joint-type"},$e={key:0,class:"joint-control-row"},Ge={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"},se=.001,tt=1e3,he=60,ot={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(a,{expose:t}){const i=a;e.ref(!0);const s=e.ref([]),l=e.ref(null),m=e.ref(null),b=e.ref(12.5),r=e.ref(),x=e.ref(1302),M=e.ref(!1),C=e.ref(!1),N=e.ref(0),O=e.ref(0),h=e.ref(null),S=o.MathUtils.degToRad,v=e.ref(1),n=()=>tt/he/v.value;let f=[];e.watch(()=>i.animationData,c=>{var d;console.log(111,c),x.value=c.extra.管长,b.value=c.extra.外径/2;let w=((d=fe.cloneDeep(c))==null?void 0:d.动画输出)??[];w&&w.length>0&&(f=w)},{deep:!0}),e.computed(()=>f.length>0);const E=(c,w=!1)=>c==="revolute"?w?Math.PI:-Math.PI:c==="prismatic"?w?1:-1:0,R=()=>{if(!l.value)return ElMessage.error("未加载 URDF"),!1;let c=null;return l.value.traverse(w=>{w.name==="Pipe_Link"&&!c&&w.traverse(d=>{d instanceof o.Mesh&&!c&&(c=d)})}),c?(r.value=c,c.material=new o.MeshPhongMaterial({color:11184810,shininess:80,side:o.DoubleSide}),!0):(ElMessage.error("Pipe_Link 内未找到 Mesh"),!1)},Z=c=>{if(!c||!c.joints)return console.warn("URDF模型没有关节信息"),[];let w=null;if(c.traverse(P=>{P.name==="Pipe_Link"&&!w&&(w=P)}),w)r.value=w;else return console.warn("未找到管子模型"),[];const d=[];return Object.keys(c.joints).forEach(P=>{const y=c.joints[P];if(y._jointType==="fixed")return;const j=y.limit?{lower:y.limit.lower??E(y._jointType,!1),upper:y.limit.upper??E(y._jointType,!0)}:{lower:E(y._jointType,!1),upper:E(y._jointType,!0)};d.push({name:P,type:y._jointType||"unknown",limit:j,currentValue:y.angle||0,urdfJoint:y})}),d.sort((P,y)=>P.name.localeCompare(y.name))},I=(c,w)=>{const d=s.value.find(y=>y.name===c);if(!d)return;const P=parseFloat(w);if(d.limit){const y=Math.max(d.limit.lower,Math.min(d.limit.upper,P));d.currentValue=y}else d.currentValue=P;i.model&&i.model.setJointValue?i.model.setJointValue(c,d.currentValue):d.urdfJoint&&d.urdfJoint.setJointValue(d.currentValue)},F=c=>c.reduce((w,d)=>{let P=0;const y=d.Y??0,j=d.C??0,g=d.R??0;return y>0&&(P+=y),j>0&&g>0&&(P+=g*S(j)),w+P},0),Y=c=>{const w=[],d=c.Y??0,P=c.B??0,y=c.C??0,j=c.R??0,g={pos:new o.Vector3(0,0,0),localY:new o.Vector3(0,1,0),localX:new o.Vector3(1,0,0),localZ:new o.Vector3(0,0,1)};if(!d&&!y)return w;if(w.push(g.pos.clone()),P!==0){const u=new o.Matrix4().makeRotationAxis(g.localY,S(P));g.localX.applyMatrix4(u),g.localZ.applyMatrix4(u)}if(d>0&&(g.pos.add(g.localY.clone().multiplyScalar(d*se)),w.push(g.pos.clone())),y>0&&j>0){const u=S(y),z=j*se,X=g.pos.clone().add(g.localX.clone().multiplyScalar(-z)),Q=Math.max(16,Math.ceil(y/5));for(let $=1;$<=Q;$++){const te=u*$/Q,V=new o.Matrix4().makeRotationAxis(g.localZ,te),q=g.localX.clone().multiplyScalar(z).applyMatrix4(V),ee=X.clone().add(q);w.push(ee)}}return w},_=c=>{const w=f.slice(0,c+1),d=F(w),P=Math.max(0,x.value-d),y=[];y.push(new o.Vector3(0,0,0));const j=new o.Vector3(0,P*se,0);P>0&&y.push(j);let g={pos:j.clone(),localY:new o.Vector3(0,1,0),localX:new o.Vector3(1,0,0),localZ:new o.Vector3(0,0,1)};const u=[];for(let z=w.length-1;z>=0;z--){const X=w[z],Q=Y(X);if(Q.length>0){const $=Q.map(q=>{const ee=q.clone(),de=new o.Matrix4;return de.makeBasis(g.localX,g.localY,g.localZ),ee.applyMatrix4(de),ee.add(g.pos)});u.push($);const te=$[$.length-1];g.pos=te.clone();const V=X.B??0,J=X.C??0;if(V!==0){const q=new o.Matrix4().makeRotationAxis(g.localY,S(V));g.localX.applyMatrix4(q),g.localZ.applyMatrix4(q)}if(J>0){const q=S(J),ee=new o.Matrix4().makeRotationAxis(g.localZ,q);g.localY.applyMatrix4(ee),g.localX.applyMatrix4(ee)}}}for(const z of u)z.length>1&&y.push(...z.slice(1));y.length<2&&y.push(new o.Vector3(0,.001,0));try{const z=new o.CatmullRomCurve3(y,!1,"catmullrom",.01),X=new o.TubeGeometry(z,Math.max(2,y.length*4),b.value*se,18,!1);r.value.geometry.dispose(),r.value.geometry=X}catch(z){console.error("管件更新失败",z)}},p=(c,w)=>{c&&(Object.keys(c).forEach(d=>{const P=c[d],y=s.value.find(j=>j.name===d);y&&(y.currentValue=P,i.model&&i.model.setJointValue?i.model.setJointValue(d,P):y.urdfJoint&&y.urdfJoint.setJointValue(P))}),_(w))},D=(c,w,d)=>c+(w-c)*d,U=(c,w,d)=>{if(!c||!w)return c||w;const P={};return Object.keys(c).forEach(y=>{const j=c[y],g=w[y];P[y]=D(j,g||j,d)}),P},T=()=>{if(f.length===0){console.warn("没有动画数据");return}R(),M.value=!0,C.value=!1;const c=()=>{if(!M.value||C.value)return;const w=O.value/he,d=N.value,P=f[N.value],y=f[N.value+1];if(y){const j=U(P,y,w);p(j,d)}else p(P,d);if(O.value++,O.value>=he&&(O.value=0,N.value++,N.value>=f.length-1)){L();return}h.value=setTimeout(c,n())};c()},W=()=>{C.value=!0,h.value&&(clearTimeout(h.value),h.value=null)},L=()=>{M.value=!1,C.value=!1,v.value=1,h.value&&(clearTimeout(h.value),h.value=null)};t({startAnimation:T,pauseAnimation:W,stopAnimation:L,resetAll:()=>{L(),N.value=0,O.value=0,s.value.forEach(c=>{(c.type==="revolute"||c.type==="prismatic")&&I(c.name,0)})},fastForward:()=>{v.value<4&&(v.value=Math.min(4,v.value*2))},fastBackward:()=>{v.value>.25&&(v.value=Math.max(.25,v.value/2))}}),e.watch(()=>i.model,c=>{c?(l.value=c,s.value=Z(c)):s.value=[]},{immediate:!0});const ae=()=>{!i.model||M.value&&!C.value||s.value.forEach(c=>{c.urdfJoint&&c.urdfJoint.angle!==void 0&&(c.currentValue=c.urdfJoint.angle)})},le=()=>{const c=()=>{ae(),m.value=requestAnimationFrame(c)};c()},re=()=>{m.value&&(cancelAnimationFrame(m.value),m.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{re(),L()}),(c,w)=>(e.openBlock(),e.createElementBlock("div",Ue,[s.value.length>0?(e.openBlock(),e.createElementBlock("div",Fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>{var P,y,j,g;return e.openBlock(),e.createElementBlock("div",{key:d.name,class:"joint-item"},[e.createElementVNode("div",Ye,[e.createElementVNode("div",Ze,[e.createElementVNode("span",He,e.toDisplayString(d.name),1),e.createElementVNode("span",Ke," ["+e.toDisplayString(((P=d.limit)==null?void 0:P.lower.toFixed(2))??(d.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((y=d.limit)==null?void 0:y.upper.toFixed(2))??(d.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",Xe,e.toDisplayString(d.type),1)]),d.type==="revolute"||d.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",Ge,[e.createElementVNode("input",{type:"range",min:((j=d.limit)==null?void 0:j.lower)??(d.type==="revolute"?-Math.PI:-1),max:((g=d.limit)==null?void 0:g.upper)??(d.type==="revolute"?Math.PI:1),step:.01,value:d.currentValue,onInput:u=>I(d.name,u.target.value),class:"joint-slider",disabled:M.value&&!C.value},null,40,Je)]),e.createElementVNode("div",qe,[e.createElementVNode("span",We,e.toDisplayString(d.currentValue?Number(d.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Qe,e.toDisplayString(d.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",et,w[0]||(w[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},it=ie._export_sfc(ot,[["__scopeId","data-v-a874abed"]]),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,i=e.computed(()=>({backgroundColor:t.backgroundColor})),s=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>{const{size:m}=t;let b=`${m}`;return b=`${b.replace("px","")}px`,{width:b,height:b}});return(m,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:m.active}]),style:e.normalizeStyle(i.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[m.$attrs.class,m.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(l.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":s.value},null,8,nt)],6))],6))}}),A=ie._export_sfc(st,[["__scopeId","data-v-53bfc052"]]),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:i}){const s=i;let l=null,m=!1;const b=e.ref(null),r=e.ref(!1),x=e.ref("");e.ref(!1);const M=e.ref(!1),C=e.ref(!1),N=e.ref(""),O=e.ref(!1),h=e.ref(""),S=e.ref(),{currentModels:v,initialCameraPosition:n,initialTargetPosition:f,initThreeJS:E,handleResize:R,fitCameraToAllModels:Z,getThreeJSObjects:I,clearAllModels:F,cleanup:Y}=Ce(b),{isAnimating:_,toggleAnimation:p,stopAnimation:D}=Ae(I,v),{isClipping:U,activeClippingAxis:T,toggleClipping:W,updateClippingPlanes:L}=Ne(I,v),{addModelsFromUrls:K,loadModelByDefaultPath:G,urdfModel:oe,modelBoundingBoxes:ae}=o.useModelLoader(I,v,r,x,F),le=()=>{if(M.value||v.value.length===0)return;M.value=!0,_.value&&D();const{camera:g,controls:u}=I();if(!g||!u)return;u.enabled=!0;const z=J=>J<.5?4*J*J*J:1-Math.pow(-2*J+2,3)/2,X=g.position.clone(),Q=u.target.clone(),$=1500,te=Date.now(),V=()=>{const J=Date.now()-te,q=Math.min(J/$,1),ee=z(q);g.position.lerpVectors(X,n.value,ee),u.target.lerpVectors(Q,f.value,ee),q<1?requestAnimationFrame(V):M.value=!1};V()},re=async()=>m?Promise.resolve():new Promise(g=>{const u=()=>{m?g():requestAnimationFrame(u)};u()}),c=async(g,u)=>{try{await re(),_.value&&D(),U.value&&W();const z=await u(g);return Z(ae),z}catch(z){throw console.error("加载模型失败:",z),z}},w=async g=>c(g,K),d=async g=>c(g,G),P=g=>{C.value=!0,N.value=g,g==="剖面视图"&&!U.value&&W()},y=g=>{O.value=!0,h.value=g,g==="动画仿真"&&s("getAnimationData")},j=()=>{e.nextTick(()=>{var g;(g=S.value)==null||g.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{E(),l=I().scene,m=!0,window.addEventListener("resize",R)}catch(g){console.error("Three.js初始化失败:",g)}}),e.onBeforeUnmount(()=>{m=!1,N.value="",h.value="",window.removeEventListener("resize",R),_.value&&D(),Y()}),t({addModelsFromUrls:w,loadModelByDefaultPath:d}),(g,u)=>{var X,Q,$,te;const z=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:b,class:"threejs-container"},null,512),e.createElementVNode("div",lt,[e.createVNode(A,{name:"guanjianjiexi",size:"34"}),e.createVNode(A,{name:"guanjiekongzhi",size:"34"}),e.createVNode(A,{name:"gongyishengcheng",size:"34"}),e.createVNode(A,{name:"buchangshezhi",size:"34"}),e.createVNode(A,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",rt,[e.createVNode(A,{name:"viewReset",size:"24",onClick:le,title:"重置"}),e.createVNode(A,{name:"fangda",size:"24",title:"放大"}),e.createVNode(A,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(A,{name:"lookAround",size:"24",onClick:e.unref(p),title:e.unref(_)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",ct,[e.createVNode(A,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=V=>P("场景树")),active:C.value&&N.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(A,{name:"clipping",size:"24",onClick:u[1]||(u[1]=V=>P("剖面视图")),active:C.value&&N.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(A,{name:"donghuafangzhen",size:"24",onClick:u[2]||(u[2]=V=>P("场景树3"))}),e.createVNode(A,{name:"donghuafangzhen",size:"24",onClick:u[3]||(u[3]=V=>P("场景4"))})]),e.createElementVNode("div",ht,[e.createVNode(A,{name:"donghuafangzhen",size:"24"}),e.createVNode(A,{name:"donghuafangzhen",size:"24"}),e.createVNode(A,{name:"guanjiekongzhi",size:"24",onClick:u[4]||(u[4]=V=>y("关节控制")),active:O.value&&h.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(A,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:u[5]||(u[5]=V=>y("动画仿真")),active:O.value&&h.value==="动画仿真"},null,8,["active"]),e.createVNode(A,{name:"donghuafangzhen",size:"24"}),e.createVNode(A,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",ut,[e.createVNode(A,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(X=S.value)==null?void 0:X.fastBackward},null,8,["onClick"]),e.createVNode(A,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:j}),e.createVNode(A,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(Q=S.value)==null?void 0:Q.fastForward},null,8,["onClick"]),e.createVNode(A,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:($=S.value)==null?void 0:$.pauseAnimation},null,8,["onClick"]),e.createVNode(A,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(te=S.value)==null?void 0:te.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",dt,[e.createElementVNode("div",pt,[e.createElementVNode("span",null,e.toDisplayString(N.value),1),e.createElementVNode("span",{class:"close",onClick:u[6]||(u[6]=V=>C.value=!1)}," X ")]),e.createVNode(z,{"max-height":"650px"},{default:e.withCtx(()=>[N.value==="场景树"?(e.openBlock(),e.createBlock(Be,{key:0,model:e.unref(oe)},null,8,["model"])):e.createCommentVNode("",!0),N.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]=V=>e.isRef(T)?T.value=V:null),onChange:u[8]||(u[8]=(...V)=>e.unref(L)&&e.unref(L)(...V))},null,544),[[e.vModelRadio,e.unref(T)]]),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]=V=>e.isRef(T)?T.value=V:null),onChange:u[10]||(u[10]=(...V)=>e.unref(L)&&e.unref(L)(...V))},null,544),[[e.vModelRadio,e.unref(T)]]),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]=V=>e.isRef(T)?T.value=V:null),onChange:u[12]||(u[12]=(...V)=>e.unref(L)&&e.unref(L)(...V))},null,544),[[e.vModelRadio,e.unref(T)]]),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]=V=>e.isRef(T)?T.value=V:null),onChange:u[14]||(u[14]=(...V)=>e.unref(L)&&e.unref(L)(...V))},null,544),[[e.vModelRadio,e.unref(T)]]),u[19]||(u[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,C.value]]),e.withDirectives(e.createElementVNode("div",bt,[e.createElementVNode("div",wt,[e.createElementVNode("span",null,e.toDisplayString(h.value),1),e.createElementVNode("span",{class:"close",onClick:u[15]||(u[15]=V=>O.value=!1)}," X ")]),e.createVNode(z,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(it,{ref_key:"jointRef",ref:S,model:e.unref(oe),scene:e.unref(l),animationData:a.animationData},null,8,["model","scene","animationData"]),[[e.vShow,h.value==="关节控制"]]),e.withDirectives(e.createVNode(Oe,{animationData:a.animationData},null,8,["animationData"]),[[e.vShow,h.value==="动画仿真"]])]),_:1})],512),[[e.vShow,O.value]]),r.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(x.value),1)])):e.createCommentVNode("",!0)])}}},Mt=ie._export_sfc(Pt,[["__scopeId","data-v-3230489b"]]);exports.default=Mt;
|