e9e2200cdd5653c7fe1fb137724efa884f5824ee556a1d915fb2119733f63ec3.json 61 KB

1
  1. {"ast":null,"code":"import { Scene } from \"../../scene.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { TransformNode } from \"../../Meshes/transformNode.js\";\nimport { Camera } from \"../../Cameras/camera.js\";\n/**\n * Base behavior for six degrees of freedom interactions in XR experiences.\n * Creates virtual meshes that are dragged around\n * And observables for position/rotation changes\n */\nexport class BaseSixDofDragBehavior {\n constructor() {\n this._attachedToElement = false;\n this._virtualMeshesInfo = {};\n this._tmpVector = new Vector3();\n this._tmpQuaternion = new Quaternion();\n this._dragType = {\n NONE: 0,\n DRAG: 1,\n DRAG_WITH_CONTROLLER: 2,\n NEAR_DRAG: 3\n };\n this._moving = false;\n this._dragging = this._dragType.NONE;\n /**\n * The list of child meshes that can receive drag events\n * If `null`, all child meshes will receive drag event\n */\n this.draggableMeshes = null;\n /**\n * How much faster the object should move when the controller is moving towards it. This is useful to bring objects that are far away from the user to them faster. Set this to 0 to avoid any speed increase. (Default: 3)\n */\n this.zDragFactor = 3;\n /**\n * In case of multipointer interaction, all pointer ids currently active are stored here\n */\n this.currentDraggingPointerIds = [];\n /**\n /**\n * If camera controls should be detached during the drag\n */\n this.detachCameraControls = true;\n /**\n * Fires each time a drag starts\n */\n this.onDragStartObservable = new Observable();\n /**\n * Fires each time a drag happens\n */\n this.onDragObservable = new Observable();\n /**\n * Fires each time a drag ends (eg. mouse release after drag)\n */\n this.onDragEndObservable = new Observable();\n /**\n * Should the behavior allow simultaneous pointers to interact with the owner node.\n */\n this.allowMultiPointer = true;\n }\n /**\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\n */\n get currentDraggingPointerId() {\n if (this.currentDraggingPointerIds[0] !== undefined) {\n return this.currentDraggingPointerIds[0];\n }\n return -1;\n }\n set currentDraggingPointerId(value) {\n this.currentDraggingPointerIds[0] = value;\n }\n /**\n * Get or set the currentDraggingPointerId\n * @deprecated Please use currentDraggingPointerId instead\n */\n get currentDraggingPointerID() {\n return this.currentDraggingPointerId;\n }\n set currentDraggingPointerID(currentDraggingPointerID) {\n this.currentDraggingPointerId = currentDraggingPointerID;\n }\n /**\n * The name of the behavior\n */\n get name() {\n return \"BaseSixDofDrag\";\n }\n /**\n * Returns true if the attached mesh is currently moving with this behavior\n */\n get isMoving() {\n return this._moving;\n }\n /**\n * Initializes the behavior\n */\n init() {}\n /**\n * In the case of multiple active cameras, the cameraToUseForPointers should be used if set instead of active camera\n */\n get _pointerCamera() {\n if (this._scene.cameraToUseForPointers) {\n return this._scene.cameraToUseForPointers;\n } else {\n return this._scene.activeCamera;\n }\n }\n _createVirtualMeshInfo() {\n // Setup virtual meshes to be used for dragging without dirtying the existing scene\n const dragMesh = new TransformNode(\"\", BaseSixDofDragBehavior._virtualScene);\n dragMesh.rotationQuaternion = new Quaternion();\n const originMesh = new TransformNode(\"\", BaseSixDofDragBehavior._virtualScene);\n originMesh.rotationQuaternion = new Quaternion();\n const pivotMesh = new TransformNode(\"\", BaseSixDofDragBehavior._virtualScene);\n pivotMesh.rotationQuaternion = new Quaternion();\n return {\n dragging: false,\n moving: false,\n dragMesh,\n originMesh,\n pivotMesh,\n startingPivotPosition: new Vector3(),\n startingPivotOrientation: new Quaternion(),\n startingPosition: new Vector3(),\n startingOrientation: new Quaternion(),\n lastOriginPosition: new Vector3(),\n lastDragPosition: new Vector3()\n };\n }\n _resetVirtualMeshesPosition() {\n for (let i = 0; i < this.currentDraggingPointerIds.length; i++) {\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.position.copyFrom(this._ownerNode.getAbsolutePivotPoint());\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.rotationQuaternion.copyFrom(this._ownerNode.rotationQuaternion);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingPivotPosition.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.position);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingPivotOrientation.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.rotationQuaternion);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingPosition.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].dragMesh.position);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingOrientation.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].dragMesh.rotationQuaternion);\n }\n }\n _pointerUpdate2D(ray, pointerId, zDragFactor) {\n if (this._pointerCamera && this._pointerCamera.cameraRigMode == Camera.RIG_MODE_NONE && !this._pointerCamera._isLeftCamera && !this._pointerCamera._isRightCamera) {\n ray.origin.copyFrom(this._pointerCamera.globalPosition);\n zDragFactor = 0;\n }\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n // Calculate controller drag distance in controller space\n const originDragDifference = TmpVectors.Vector3[0];\n ray.origin.subtractToRef(virtualMeshesInfo.lastOriginPosition, originDragDifference);\n virtualMeshesInfo.lastOriginPosition.copyFrom(ray.origin);\n const localOriginDragDifference = -Vector3.Dot(originDragDifference, ray.direction);\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.pivotMesh);\n this._applyZOffset(virtualMeshesInfo.dragMesh, localOriginDragDifference, zDragFactor);\n this._applyZOffset(virtualMeshesInfo.pivotMesh, localOriginDragDifference, zDragFactor);\n // Update the controller position\n virtualMeshesInfo.originMesh.position.copyFrom(ray.origin);\n const lookAt = TmpVectors.Vector3[0];\n ray.origin.addToRef(ray.direction, lookAt);\n virtualMeshesInfo.originMesh.lookAt(lookAt);\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.pivotMesh);\n }\n _pointerUpdateXR(controllerAimTransform, controllerGripTransform, pointerId, zDragFactor) {\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n virtualMeshesInfo.originMesh.position.copyFrom(controllerAimTransform.position);\n if (this._dragging === this._dragType.NEAR_DRAG && controllerGripTransform) {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(controllerGripTransform.rotationQuaternion);\n } else {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(controllerAimTransform.rotationQuaternion);\n }\n virtualMeshesInfo.pivotMesh.computeWorldMatrix(true);\n virtualMeshesInfo.dragMesh.computeWorldMatrix(true);\n // Z scaling logic\n if (zDragFactor !== 0) {\n // Camera.getForwardRay modifies TmpVectors.Vector[0-3], so cache it in advance\n const cameraForwardVec = TmpVectors.Vector3[0];\n const originDragDirection = TmpVectors.Vector3[1];\n cameraForwardVec.copyFrom(this._pointerCamera.getForwardRay().direction);\n virtualMeshesInfo.originMesh.position.subtractToRef(virtualMeshesInfo.lastOriginPosition, originDragDirection);\n virtualMeshesInfo.lastOriginPosition.copyFrom(virtualMeshesInfo.originMesh.position);\n const controllerDragDistance = originDragDirection.length();\n originDragDirection.normalize();\n const cameraToDrag = TmpVectors.Vector3[2];\n const controllerToDrag = TmpVectors.Vector3[3];\n virtualMeshesInfo.dragMesh.absolutePosition.subtractToRef(this._pointerCamera.globalPosition, cameraToDrag);\n virtualMeshesInfo.dragMesh.absolutePosition.subtractToRef(virtualMeshesInfo.originMesh.position, controllerToDrag);\n const controllerToDragDistance = controllerToDrag.length();\n cameraToDrag.normalize();\n controllerToDrag.normalize();\n const controllerDragScaling = Math.abs(Vector3.Dot(originDragDirection, controllerToDrag)) * Vector3.Dot(originDragDirection, cameraForwardVec);\n let zOffsetScaling = controllerDragScaling * zDragFactor * controllerDragDistance * controllerToDragDistance;\n // Prevent pulling the mesh through the controller\n const minDistanceFromControllerToDragMesh = 0.01;\n if (zOffsetScaling < 0 && minDistanceFromControllerToDragMesh - controllerToDragDistance > zOffsetScaling) {\n zOffsetScaling = Math.min(minDistanceFromControllerToDragMesh - controllerToDragDistance, 0);\n }\n controllerToDrag.scaleInPlace(zOffsetScaling);\n controllerToDrag.addToRef(virtualMeshesInfo.pivotMesh.absolutePosition, this._tmpVector);\n virtualMeshesInfo.pivotMesh.setAbsolutePosition(this._tmpVector);\n controllerToDrag.addToRef(virtualMeshesInfo.dragMesh.absolutePosition, this._tmpVector);\n virtualMeshesInfo.dragMesh.setAbsolutePosition(this._tmpVector);\n }\n }\n /**\n * Attaches the scale behavior the passed in mesh\n * @param ownerNode The mesh that will be scaled around once attached\n */\n attach(ownerNode) {\n this._ownerNode = ownerNode;\n this._scene = this._ownerNode.getScene();\n if (!BaseSixDofDragBehavior._virtualScene) {\n BaseSixDofDragBehavior._virtualScene = new Scene(this._scene.getEngine(), {\n virtual: true\n });\n BaseSixDofDragBehavior._virtualScene.detachControl();\n }\n const pickPredicate = m => {\n return this._ownerNode === m || m.isDescendantOf(this._ownerNode) && (!this.draggableMeshes || this.draggableMeshes.indexOf(m) !== -1);\n };\n this._pointerObserver = this._scene.onPointerObservable.add(pointerInfo => {\n const pointerId = pointerInfo.event.pointerId;\n if (!this._virtualMeshesInfo[pointerId]) {\n this._virtualMeshesInfo[pointerId] = this._createVirtualMeshInfo();\n }\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n const isXRPointer = pointerInfo.event.pointerType === \"xr-near\" || pointerInfo.event.pointerType === \"xr\";\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\n if (!virtualMeshesInfo.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.pickedPoint && pointerInfo.pickInfo.ray && (!isXRPointer || pointerInfo.pickInfo.aimTransform) && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\n if ((!this.allowMultiPointer || isXRPointer) && this.currentDraggingPointerIds.length > 0) {\n return;\n }\n if (this._pointerCamera && this._pointerCamera.cameraRigMode === Camera.RIG_MODE_NONE && !this._pointerCamera._isLeftCamera && !this._pointerCamera._isRightCamera) {\n pointerInfo.pickInfo.ray.origin.copyFrom(this._pointerCamera.globalPosition);\n }\n this._ownerNode.computeWorldMatrix(true);\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n if (isXRPointer) {\n this._dragging = pointerInfo.pickInfo.originMesh ? this._dragType.NEAR_DRAG : this._dragType.DRAG_WITH_CONTROLLER;\n virtualMeshesInfo.originMesh.position.copyFrom(pointerInfo.pickInfo.aimTransform.position);\n if (this._dragging === this._dragType.NEAR_DRAG && pointerInfo.pickInfo.gripTransform) {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(pointerInfo.pickInfo.gripTransform.rotationQuaternion);\n } else {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(pointerInfo.pickInfo.aimTransform.rotationQuaternion);\n }\n } else {\n this._dragging = this._dragType.DRAG;\n virtualMeshesInfo.originMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);\n }\n virtualMeshesInfo.lastOriginPosition.copyFrom(virtualMeshesInfo.originMesh.position);\n virtualMeshesInfo.dragMesh.position.copyFrom(pointerInfo.pickInfo.pickedPoint);\n virtualMeshesInfo.lastDragPosition.copyFrom(pointerInfo.pickInfo.pickedPoint);\n virtualMeshesInfo.pivotMesh.position.copyFrom(this._ownerNode.getAbsolutePivotPoint());\n virtualMeshesInfo.pivotMesh.rotationQuaternion.copyFrom(this._ownerNode.absoluteRotationQuaternion);\n virtualMeshesInfo.startingPosition.copyFrom(virtualMeshesInfo.dragMesh.position);\n virtualMeshesInfo.startingPivotPosition.copyFrom(virtualMeshesInfo.pivotMesh.position);\n virtualMeshesInfo.startingOrientation.copyFrom(virtualMeshesInfo.dragMesh.rotationQuaternion);\n virtualMeshesInfo.startingPivotOrientation.copyFrom(virtualMeshesInfo.pivotMesh.rotationQuaternion);\n if (isXRPointer) {\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.pivotMesh);\n } else {\n virtualMeshesInfo.originMesh.lookAt(virtualMeshesInfo.dragMesh.position);\n }\n // Update state\n virtualMeshesInfo.dragging = true;\n if (this.currentDraggingPointerIds.indexOf(pointerId) === -1) {\n this.currentDraggingPointerIds.push(pointerId);\n }\n // Detach camera controls\n if (this.detachCameraControls && this._pointerCamera && !this._pointerCamera.leftCamera) {\n if (this._pointerCamera.inputs && this._pointerCamera.inputs.attachedToElement) {\n this._pointerCamera.detachControl();\n this._attachedToElement = true;\n } else if (!this.allowMultiPointer || this.currentDraggingPointerIds.length === 0) {\n this._attachedToElement = false;\n }\n }\n this._targetDragStart(virtualMeshesInfo.pivotMesh.position, virtualMeshesInfo.pivotMesh.rotationQuaternion, pointerId);\n this.onDragStartObservable.notifyObservers({\n position: virtualMeshesInfo.pivotMesh.position\n });\n }\n } else if (pointerInfo.type == PointerEventTypes.POINTERUP || pointerInfo.type == PointerEventTypes.POINTERDOUBLETAP) {\n const registeredPointerIndex = this.currentDraggingPointerIds.indexOf(pointerId);\n // Update state\n virtualMeshesInfo.dragging = false;\n if (registeredPointerIndex !== -1) {\n this.currentDraggingPointerIds.splice(registeredPointerIndex, 1);\n if (this.currentDraggingPointerIds.length === 0) {\n this._moving = false;\n this._dragging = this._dragType.NONE;\n // Reattach camera controls\n if (this.detachCameraControls && this._attachedToElement && this._pointerCamera && !this._pointerCamera.leftCamera) {\n this._reattachCameraControls();\n this._attachedToElement = false;\n }\n }\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.pivotMesh);\n this._targetDragEnd(pointerId);\n this.onDragEndObservable.notifyObservers({});\n }\n } else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\n const registeredPointerIndex = this.currentDraggingPointerIds.indexOf(pointerId);\n if (registeredPointerIndex !== -1 && virtualMeshesInfo.dragging && pointerInfo.pickInfo && (pointerInfo.pickInfo.ray || pointerInfo.pickInfo.aimTransform)) {\n let zDragFactor = this.zDragFactor;\n // 2 pointer interaction should not have a z axis drag factor\n // as well as near interaction\n if (this.currentDraggingPointerIds.length > 1 || pointerInfo.pickInfo.originMesh) {\n zDragFactor = 0;\n }\n this._ownerNode.computeWorldMatrix(true);\n if (!isXRPointer) {\n this._pointerUpdate2D(pointerInfo.pickInfo.ray, pointerId, zDragFactor);\n } else {\n this._pointerUpdateXR(pointerInfo.pickInfo.aimTransform, pointerInfo.pickInfo.gripTransform, pointerId, zDragFactor);\n }\n // Get change in rotation\n this._tmpQuaternion.copyFrom(virtualMeshesInfo.startingPivotOrientation);\n this._tmpQuaternion.x = -this._tmpQuaternion.x;\n this._tmpQuaternion.y = -this._tmpQuaternion.y;\n this._tmpQuaternion.z = -this._tmpQuaternion.z;\n virtualMeshesInfo.pivotMesh.absoluteRotationQuaternion.multiplyToRef(this._tmpQuaternion, this._tmpQuaternion);\n virtualMeshesInfo.pivotMesh.absolutePosition.subtractToRef(virtualMeshesInfo.startingPivotPosition, this._tmpVector);\n this.onDragObservable.notifyObservers({\n delta: this._tmpVector,\n position: virtualMeshesInfo.pivotMesh.position,\n pickInfo: pointerInfo.pickInfo\n });\n // Notify herited methods and observables\n this._targetDrag(this._tmpVector, this._tmpQuaternion, pointerId);\n virtualMeshesInfo.lastDragPosition.copyFrom(virtualMeshesInfo.dragMesh.absolutePosition);\n this._moving = true;\n }\n }\n });\n }\n _applyZOffset(node, localOriginDragDifference, zDragFactor) {\n // Determine how much the controller moved to/away towards the dragged object and use this to move the object further when its further away\n node.position.z -= node.position.z < 1 ? localOriginDragDifference * zDragFactor : localOriginDragDifference * zDragFactor * node.position.z;\n if (node.position.z < 0) {\n node.position.z = 0;\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _targetDragStart(worldPosition, worldRotation, pointerId) {\n // Herited classes can override that\n }\n _targetDrag(worldDeltaPosition, worldDeltaRotation, pointerId) {\n // Herited classes can override that\n }\n _targetDragEnd(pointerId) {\n // Herited classes can override that\n }\n _reattachCameraControls() {\n if (this._pointerCamera) {\n // If the camera is an ArcRotateCamera, preserve the settings from the camera\n // when reattaching control\n if (this._pointerCamera.getClassName() === \"ArcRotateCamera\") {\n const arcRotateCamera = this._pointerCamera;\n arcRotateCamera.attachControl(arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true, arcRotateCamera._useCtrlForPanning, arcRotateCamera._panningMouseButton);\n } else {\n // preserve the settings from the camera when reattaching control\n this._pointerCamera.attachControl(this._pointerCamera.inputs ? this._pointerCamera.inputs.noPreventDefault : true);\n }\n }\n }\n /**\n * Detaches the behavior from the mesh\n */\n detach() {\n if (this._scene) {\n if (this.detachCameraControls && this._attachedToElement && this._pointerCamera && !this._pointerCamera.leftCamera) {\n this._reattachCameraControls();\n this._attachedToElement = false;\n }\n this._scene.onPointerObservable.remove(this._pointerObserver);\n }\n for (const pointerId in this._virtualMeshesInfo) {\n this._virtualMeshesInfo[pointerId].originMesh.dispose();\n this._virtualMeshesInfo[pointerId].dragMesh.dispose();\n }\n this.onDragEndObservable.clear();\n this.onDragObservable.clear();\n this.onDragStartObservable.clear();\n }\n}","map":{"version":3,"names":["Scene","PointerEventTypes","Vector3","Quaternion","TmpVectors","Observable","TransformNode","Camera","BaseSixDofDragBehavior","constructor","_attachedToElement","_virtualMeshesInfo","_tmpVector","_tmpQuaternion","_dragType","NONE","DRAG","DRAG_WITH_CONTROLLER","NEAR_DRAG","_moving","_dragging","draggableMeshes","zDragFactor","currentDraggingPointerIds","detachCameraControls","onDragStartObservable","onDragObservable","onDragEndObservable","allowMultiPointer","currentDraggingPointerId","undefined","value","currentDraggingPointerID","name","isMoving","init","_pointerCamera","_scene","cameraToUseForPointers","activeCamera","_createVirtualMeshInfo","dragMesh","_virtualScene","rotationQuaternion","originMesh","pivotMesh","dragging","moving","startingPivotPosition","startingPivotOrientation","startingPosition","startingOrientation","lastOriginPosition","lastDragPosition","_resetVirtualMeshesPosition","i","length","position","copyFrom","_ownerNode","getAbsolutePivotPoint","_pointerUpdate2D","ray","pointerId","cameraRigMode","RIG_MODE_NONE","_isLeftCamera","_isRightCamera","origin","globalPosition","virtualMeshesInfo","originDragDifference","subtractToRef","localOriginDragDifference","Dot","direction","addChild","_applyZOffset","lookAt","addToRef","removeChild","_pointerUpdateXR","controllerAimTransform","controllerGripTransform","computeWorldMatrix","cameraForwardVec","originDragDirection","getForwardRay","controllerDragDistance","normalize","cameraToDrag","controllerToDrag","absolutePosition","controllerToDragDistance","controllerDragScaling","Math","abs","zOffsetScaling","minDistanceFromControllerToDragMesh","min","scaleInPlace","setAbsolutePosition","attach","ownerNode","getScene","getEngine","virtual","detachControl","pickPredicate","m","isDescendantOf","indexOf","_pointerObserver","onPointerObservable","add","pointerInfo","event","isXRPointer","pointerType","type","POINTERDOWN","pickInfo","hit","pickedMesh","pickedPoint","aimTransform","gripTransform","absoluteRotationQuaternion","push","leftCamera","inputs","attachedToElement","_targetDragStart","notifyObservers","POINTERUP","POINTERDOUBLETAP","registeredPointerIndex","splice","_reattachCameraControls","_targetDragEnd","POINTERMOVE","x","y","z","multiplyToRef","delta","_targetDrag","node","worldPosition","worldRotation","worldDeltaPosition","worldDeltaRotation","getClassName","arcRotateCamera","attachControl","noPreventDefault","_useCtrlForPanning","_panningMouseButton","detach","remove","dispose","clear"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Behaviors/Meshes/baseSixDofDragBehavior.js"],"sourcesContent":["import { Scene } from \"../../scene.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { TransformNode } from \"../../Meshes/transformNode.js\";\nimport { Camera } from \"../../Cameras/camera.js\";\n/**\n * Base behavior for six degrees of freedom interactions in XR experiences.\n * Creates virtual meshes that are dragged around\n * And observables for position/rotation changes\n */\nexport class BaseSixDofDragBehavior {\n constructor() {\n this._attachedToElement = false;\n this._virtualMeshesInfo = {};\n this._tmpVector = new Vector3();\n this._tmpQuaternion = new Quaternion();\n this._dragType = {\n NONE: 0,\n DRAG: 1,\n DRAG_WITH_CONTROLLER: 2,\n NEAR_DRAG: 3,\n };\n this._moving = false;\n this._dragging = this._dragType.NONE;\n /**\n * The list of child meshes that can receive drag events\n * If `null`, all child meshes will receive drag event\n */\n this.draggableMeshes = null;\n /**\n * How much faster the object should move when the controller is moving towards it. This is useful to bring objects that are far away from the user to them faster. Set this to 0 to avoid any speed increase. (Default: 3)\n */\n this.zDragFactor = 3;\n /**\n * In case of multipointer interaction, all pointer ids currently active are stored here\n */\n this.currentDraggingPointerIds = [];\n /**\n /**\n * If camera controls should be detached during the drag\n */\n this.detachCameraControls = true;\n /**\n * Fires each time a drag starts\n */\n this.onDragStartObservable = new Observable();\n /**\n * Fires each time a drag happens\n */\n this.onDragObservable = new Observable();\n /**\n * Fires each time a drag ends (eg. mouse release after drag)\n */\n this.onDragEndObservable = new Observable();\n /**\n * Should the behavior allow simultaneous pointers to interact with the owner node.\n */\n this.allowMultiPointer = true;\n }\n /**\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\n */\n get currentDraggingPointerId() {\n if (this.currentDraggingPointerIds[0] !== undefined) {\n return this.currentDraggingPointerIds[0];\n }\n return -1;\n }\n set currentDraggingPointerId(value) {\n this.currentDraggingPointerIds[0] = value;\n }\n /**\n * Get or set the currentDraggingPointerId\n * @deprecated Please use currentDraggingPointerId instead\n */\n get currentDraggingPointerID() {\n return this.currentDraggingPointerId;\n }\n set currentDraggingPointerID(currentDraggingPointerID) {\n this.currentDraggingPointerId = currentDraggingPointerID;\n }\n /**\n * The name of the behavior\n */\n get name() {\n return \"BaseSixDofDrag\";\n }\n /**\n * Returns true if the attached mesh is currently moving with this behavior\n */\n get isMoving() {\n return this._moving;\n }\n /**\n * Initializes the behavior\n */\n init() { }\n /**\n * In the case of multiple active cameras, the cameraToUseForPointers should be used if set instead of active camera\n */\n get _pointerCamera() {\n if (this._scene.cameraToUseForPointers) {\n return this._scene.cameraToUseForPointers;\n }\n else {\n return this._scene.activeCamera;\n }\n }\n _createVirtualMeshInfo() {\n // Setup virtual meshes to be used for dragging without dirtying the existing scene\n const dragMesh = new TransformNode(\"\", BaseSixDofDragBehavior._virtualScene);\n dragMesh.rotationQuaternion = new Quaternion();\n const originMesh = new TransformNode(\"\", BaseSixDofDragBehavior._virtualScene);\n originMesh.rotationQuaternion = new Quaternion();\n const pivotMesh = new TransformNode(\"\", BaseSixDofDragBehavior._virtualScene);\n pivotMesh.rotationQuaternion = new Quaternion();\n return {\n dragging: false,\n moving: false,\n dragMesh,\n originMesh,\n pivotMesh,\n startingPivotPosition: new Vector3(),\n startingPivotOrientation: new Quaternion(),\n startingPosition: new Vector3(),\n startingOrientation: new Quaternion(),\n lastOriginPosition: new Vector3(),\n lastDragPosition: new Vector3(),\n };\n }\n _resetVirtualMeshesPosition() {\n for (let i = 0; i < this.currentDraggingPointerIds.length; i++) {\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.position.copyFrom(this._ownerNode.getAbsolutePivotPoint());\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.rotationQuaternion.copyFrom(this._ownerNode.rotationQuaternion);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingPivotPosition.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.position);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingPivotOrientation.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].pivotMesh.rotationQuaternion);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingPosition.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].dragMesh.position);\n this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].startingOrientation.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[i]].dragMesh.rotationQuaternion);\n }\n }\n _pointerUpdate2D(ray, pointerId, zDragFactor) {\n if (this._pointerCamera && this._pointerCamera.cameraRigMode == Camera.RIG_MODE_NONE && !this._pointerCamera._isLeftCamera && !this._pointerCamera._isRightCamera) {\n ray.origin.copyFrom(this._pointerCamera.globalPosition);\n zDragFactor = 0;\n }\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n // Calculate controller drag distance in controller space\n const originDragDifference = TmpVectors.Vector3[0];\n ray.origin.subtractToRef(virtualMeshesInfo.lastOriginPosition, originDragDifference);\n virtualMeshesInfo.lastOriginPosition.copyFrom(ray.origin);\n const localOriginDragDifference = -Vector3.Dot(originDragDifference, ray.direction);\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.pivotMesh);\n this._applyZOffset(virtualMeshesInfo.dragMesh, localOriginDragDifference, zDragFactor);\n this._applyZOffset(virtualMeshesInfo.pivotMesh, localOriginDragDifference, zDragFactor);\n // Update the controller position\n virtualMeshesInfo.originMesh.position.copyFrom(ray.origin);\n const lookAt = TmpVectors.Vector3[0];\n ray.origin.addToRef(ray.direction, lookAt);\n virtualMeshesInfo.originMesh.lookAt(lookAt);\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.pivotMesh);\n }\n _pointerUpdateXR(controllerAimTransform, controllerGripTransform, pointerId, zDragFactor) {\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n virtualMeshesInfo.originMesh.position.copyFrom(controllerAimTransform.position);\n if (this._dragging === this._dragType.NEAR_DRAG && controllerGripTransform) {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(controllerGripTransform.rotationQuaternion);\n }\n else {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(controllerAimTransform.rotationQuaternion);\n }\n virtualMeshesInfo.pivotMesh.computeWorldMatrix(true);\n virtualMeshesInfo.dragMesh.computeWorldMatrix(true);\n // Z scaling logic\n if (zDragFactor !== 0) {\n // Camera.getForwardRay modifies TmpVectors.Vector[0-3], so cache it in advance\n const cameraForwardVec = TmpVectors.Vector3[0];\n const originDragDirection = TmpVectors.Vector3[1];\n cameraForwardVec.copyFrom(this._pointerCamera.getForwardRay().direction);\n virtualMeshesInfo.originMesh.position.subtractToRef(virtualMeshesInfo.lastOriginPosition, originDragDirection);\n virtualMeshesInfo.lastOriginPosition.copyFrom(virtualMeshesInfo.originMesh.position);\n const controllerDragDistance = originDragDirection.length();\n originDragDirection.normalize();\n const cameraToDrag = TmpVectors.Vector3[2];\n const controllerToDrag = TmpVectors.Vector3[3];\n virtualMeshesInfo.dragMesh.absolutePosition.subtractToRef(this._pointerCamera.globalPosition, cameraToDrag);\n virtualMeshesInfo.dragMesh.absolutePosition.subtractToRef(virtualMeshesInfo.originMesh.position, controllerToDrag);\n const controllerToDragDistance = controllerToDrag.length();\n cameraToDrag.normalize();\n controllerToDrag.normalize();\n const controllerDragScaling = Math.abs(Vector3.Dot(originDragDirection, controllerToDrag)) * Vector3.Dot(originDragDirection, cameraForwardVec);\n let zOffsetScaling = controllerDragScaling * zDragFactor * controllerDragDistance * controllerToDragDistance;\n // Prevent pulling the mesh through the controller\n const minDistanceFromControllerToDragMesh = 0.01;\n if (zOffsetScaling < 0 && minDistanceFromControllerToDragMesh - controllerToDragDistance > zOffsetScaling) {\n zOffsetScaling = Math.min(minDistanceFromControllerToDragMesh - controllerToDragDistance, 0);\n }\n controllerToDrag.scaleInPlace(zOffsetScaling);\n controllerToDrag.addToRef(virtualMeshesInfo.pivotMesh.absolutePosition, this._tmpVector);\n virtualMeshesInfo.pivotMesh.setAbsolutePosition(this._tmpVector);\n controllerToDrag.addToRef(virtualMeshesInfo.dragMesh.absolutePosition, this._tmpVector);\n virtualMeshesInfo.dragMesh.setAbsolutePosition(this._tmpVector);\n }\n }\n /**\n * Attaches the scale behavior the passed in mesh\n * @param ownerNode The mesh that will be scaled around once attached\n */\n attach(ownerNode) {\n this._ownerNode = ownerNode;\n this._scene = this._ownerNode.getScene();\n if (!BaseSixDofDragBehavior._virtualScene) {\n BaseSixDofDragBehavior._virtualScene = new Scene(this._scene.getEngine(), { virtual: true });\n BaseSixDofDragBehavior._virtualScene.detachControl();\n }\n const pickPredicate = (m) => {\n return this._ownerNode === m || (m.isDescendantOf(this._ownerNode) && (!this.draggableMeshes || this.draggableMeshes.indexOf(m) !== -1));\n };\n this._pointerObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n const pointerId = pointerInfo.event.pointerId;\n if (!this._virtualMeshesInfo[pointerId]) {\n this._virtualMeshesInfo[pointerId] = this._createVirtualMeshInfo();\n }\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n const isXRPointer = pointerInfo.event.pointerType === \"xr-near\" || pointerInfo.event.pointerType === \"xr\";\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\n if (!virtualMeshesInfo.dragging &&\n pointerInfo.pickInfo &&\n pointerInfo.pickInfo.hit &&\n pointerInfo.pickInfo.pickedMesh &&\n pointerInfo.pickInfo.pickedPoint &&\n pointerInfo.pickInfo.ray &&\n (!isXRPointer || pointerInfo.pickInfo.aimTransform) &&\n pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\n if ((!this.allowMultiPointer || isXRPointer) && this.currentDraggingPointerIds.length > 0) {\n return;\n }\n if (this._pointerCamera &&\n this._pointerCamera.cameraRigMode === Camera.RIG_MODE_NONE &&\n !this._pointerCamera._isLeftCamera &&\n !this._pointerCamera._isRightCamera) {\n pointerInfo.pickInfo.ray.origin.copyFrom(this._pointerCamera.globalPosition);\n }\n this._ownerNode.computeWorldMatrix(true);\n const virtualMeshesInfo = this._virtualMeshesInfo[pointerId];\n if (isXRPointer) {\n this._dragging = pointerInfo.pickInfo.originMesh ? this._dragType.NEAR_DRAG : this._dragType.DRAG_WITH_CONTROLLER;\n virtualMeshesInfo.originMesh.position.copyFrom(pointerInfo.pickInfo.aimTransform.position);\n if (this._dragging === this._dragType.NEAR_DRAG && pointerInfo.pickInfo.gripTransform) {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(pointerInfo.pickInfo.gripTransform.rotationQuaternion);\n }\n else {\n virtualMeshesInfo.originMesh.rotationQuaternion.copyFrom(pointerInfo.pickInfo.aimTransform.rotationQuaternion);\n }\n }\n else {\n this._dragging = this._dragType.DRAG;\n virtualMeshesInfo.originMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);\n }\n virtualMeshesInfo.lastOriginPosition.copyFrom(virtualMeshesInfo.originMesh.position);\n virtualMeshesInfo.dragMesh.position.copyFrom(pointerInfo.pickInfo.pickedPoint);\n virtualMeshesInfo.lastDragPosition.copyFrom(pointerInfo.pickInfo.pickedPoint);\n virtualMeshesInfo.pivotMesh.position.copyFrom(this._ownerNode.getAbsolutePivotPoint());\n virtualMeshesInfo.pivotMesh.rotationQuaternion.copyFrom(this._ownerNode.absoluteRotationQuaternion);\n virtualMeshesInfo.startingPosition.copyFrom(virtualMeshesInfo.dragMesh.position);\n virtualMeshesInfo.startingPivotPosition.copyFrom(virtualMeshesInfo.pivotMesh.position);\n virtualMeshesInfo.startingOrientation.copyFrom(virtualMeshesInfo.dragMesh.rotationQuaternion);\n virtualMeshesInfo.startingPivotOrientation.copyFrom(virtualMeshesInfo.pivotMesh.rotationQuaternion);\n if (isXRPointer) {\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.addChild(virtualMeshesInfo.pivotMesh);\n }\n else {\n virtualMeshesInfo.originMesh.lookAt(virtualMeshesInfo.dragMesh.position);\n }\n // Update state\n virtualMeshesInfo.dragging = true;\n if (this.currentDraggingPointerIds.indexOf(pointerId) === -1) {\n this.currentDraggingPointerIds.push(pointerId);\n }\n // Detach camera controls\n if (this.detachCameraControls && this._pointerCamera && !this._pointerCamera.leftCamera) {\n if (this._pointerCamera.inputs && this._pointerCamera.inputs.attachedToElement) {\n this._pointerCamera.detachControl();\n this._attachedToElement = true;\n }\n else if (!this.allowMultiPointer || this.currentDraggingPointerIds.length === 0) {\n this._attachedToElement = false;\n }\n }\n this._targetDragStart(virtualMeshesInfo.pivotMesh.position, virtualMeshesInfo.pivotMesh.rotationQuaternion, pointerId);\n this.onDragStartObservable.notifyObservers({ position: virtualMeshesInfo.pivotMesh.position });\n }\n }\n else if (pointerInfo.type == PointerEventTypes.POINTERUP || pointerInfo.type == PointerEventTypes.POINTERDOUBLETAP) {\n const registeredPointerIndex = this.currentDraggingPointerIds.indexOf(pointerId);\n // Update state\n virtualMeshesInfo.dragging = false;\n if (registeredPointerIndex !== -1) {\n this.currentDraggingPointerIds.splice(registeredPointerIndex, 1);\n if (this.currentDraggingPointerIds.length === 0) {\n this._moving = false;\n this._dragging = this._dragType.NONE;\n // Reattach camera controls\n if (this.detachCameraControls && this._attachedToElement && this._pointerCamera && !this._pointerCamera.leftCamera) {\n this._reattachCameraControls();\n this._attachedToElement = false;\n }\n }\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.dragMesh);\n virtualMeshesInfo.originMesh.removeChild(virtualMeshesInfo.pivotMesh);\n this._targetDragEnd(pointerId);\n this.onDragEndObservable.notifyObservers({});\n }\n }\n else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\n const registeredPointerIndex = this.currentDraggingPointerIds.indexOf(pointerId);\n if (registeredPointerIndex !== -1 && virtualMeshesInfo.dragging && pointerInfo.pickInfo && (pointerInfo.pickInfo.ray || pointerInfo.pickInfo.aimTransform)) {\n let zDragFactor = this.zDragFactor;\n // 2 pointer interaction should not have a z axis drag factor\n // as well as near interaction\n if (this.currentDraggingPointerIds.length > 1 || pointerInfo.pickInfo.originMesh) {\n zDragFactor = 0;\n }\n this._ownerNode.computeWorldMatrix(true);\n if (!isXRPointer) {\n this._pointerUpdate2D(pointerInfo.pickInfo.ray, pointerId, zDragFactor);\n }\n else {\n this._pointerUpdateXR(pointerInfo.pickInfo.aimTransform, pointerInfo.pickInfo.gripTransform, pointerId, zDragFactor);\n }\n // Get change in rotation\n this._tmpQuaternion.copyFrom(virtualMeshesInfo.startingPivotOrientation);\n this._tmpQuaternion.x = -this._tmpQuaternion.x;\n this._tmpQuaternion.y = -this._tmpQuaternion.y;\n this._tmpQuaternion.z = -this._tmpQuaternion.z;\n virtualMeshesInfo.pivotMesh.absoluteRotationQuaternion.multiplyToRef(this._tmpQuaternion, this._tmpQuaternion);\n virtualMeshesInfo.pivotMesh.absolutePosition.subtractToRef(virtualMeshesInfo.startingPivotPosition, this._tmpVector);\n this.onDragObservable.notifyObservers({ delta: this._tmpVector, position: virtualMeshesInfo.pivotMesh.position, pickInfo: pointerInfo.pickInfo });\n // Notify herited methods and observables\n this._targetDrag(this._tmpVector, this._tmpQuaternion, pointerId);\n virtualMeshesInfo.lastDragPosition.copyFrom(virtualMeshesInfo.dragMesh.absolutePosition);\n this._moving = true;\n }\n }\n });\n }\n _applyZOffset(node, localOriginDragDifference, zDragFactor) {\n // Determine how much the controller moved to/away towards the dragged object and use this to move the object further when its further away\n node.position.z -= node.position.z < 1 ? localOriginDragDifference * zDragFactor : localOriginDragDifference * zDragFactor * node.position.z;\n if (node.position.z < 0) {\n node.position.z = 0;\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _targetDragStart(worldPosition, worldRotation, pointerId) {\n // Herited classes can override that\n }\n _targetDrag(worldDeltaPosition, worldDeltaRotation, pointerId) {\n // Herited classes can override that\n }\n _targetDragEnd(pointerId) {\n // Herited classes can override that\n }\n _reattachCameraControls() {\n if (this._pointerCamera) {\n // If the camera is an ArcRotateCamera, preserve the settings from the camera\n // when reattaching control\n if (this._pointerCamera.getClassName() === \"ArcRotateCamera\") {\n const arcRotateCamera = this._pointerCamera;\n arcRotateCamera.attachControl(arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true, arcRotateCamera._useCtrlForPanning, arcRotateCamera._panningMouseButton);\n }\n else {\n // preserve the settings from the camera when reattaching control\n this._pointerCamera.attachControl(this._pointerCamera.inputs ? this._pointerCamera.inputs.noPreventDefault : true);\n }\n }\n }\n /**\n * Detaches the behavior from the mesh\n */\n detach() {\n if (this._scene) {\n if (this.detachCameraControls && this._attachedToElement && this._pointerCamera && !this._pointerCamera.leftCamera) {\n this._reattachCameraControls();\n this._attachedToElement = false;\n }\n this._scene.onPointerObservable.remove(this._pointerObserver);\n }\n for (const pointerId in this._virtualMeshesInfo) {\n this._virtualMeshesInfo[pointerId].originMesh.dispose();\n this._virtualMeshesInfo[pointerId].dragMesh.dispose();\n }\n this.onDragEndObservable.clear();\n this.onDragObservable.clear();\n this.onDragStartObservable.clear();\n }\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,gBAAgB;AACtC,SAASC,iBAAiB,QAAQ,+BAA+B;AACjE,SAASC,OAAO,EAAEC,UAAU,EAAEC,UAAU,QAAQ,4BAA4B;AAC5E,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,MAAM,QAAQ,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,CAAC;EAChCC,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,kBAAkB,GAAG,KAAK;IAC/B,IAAI,CAACC,kBAAkB,GAAG,CAAC,CAAC;IAC5B,IAAI,CAACC,UAAU,GAAG,IAAIV,OAAO,CAAC,CAAC;IAC/B,IAAI,CAACW,cAAc,GAAG,IAAIV,UAAU,CAAC,CAAC;IACtC,IAAI,CAACW,SAAS,GAAG;MACbC,IAAI,EAAE,CAAC;MACPC,IAAI,EAAE,CAAC;MACPC,oBAAoB,EAAE,CAAC;MACvBC,SAAS,EAAE;IACf,CAAC;IACD,IAAI,CAACC,OAAO,GAAG,KAAK;IACpB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACN,SAAS,CAACC,IAAI;IACpC;AACR;AACA;AACA;IACQ,IAAI,CAACM,eAAe,GAAG,I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